Added profiles
This commit is contained in:
104
pom.xml
104
pom.xml
@@ -3,7 +3,6 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- mvn clean package spring-boot:repackage && java -jar target/hapi-fhir-jpaserver.war -->
|
||||
<!--
|
||||
Note: HAPI projects use the "hapi-fhir" POM as their base to provide easy management.
|
||||
You do not need to use this in your own projects, so the "parent" tag and it's
|
||||
@@ -19,10 +18,8 @@
|
||||
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<jetty_version>9.4.31.v20200723</jetty_version>
|
||||
<java.version>8</java.version>
|
||||
<spring.boot>2.3.3.RELEASE</spring.boot>
|
||||
</properties>
|
||||
|
||||
<prerequisites>
|
||||
@@ -77,12 +74,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>javax.mail-api</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- This dependency includes the core HAPI-FHIR classes -->
|
||||
<dependency>
|
||||
@@ -248,18 +239,7 @@
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.helger</groupId>
|
||||
<artifactId>ph-schematron</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
For some reason JavaDoc crashed during site generation unless we have this dependency
|
||||
@@ -284,35 +264,10 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-logging -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
<version>${spring.boot}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -347,6 +302,7 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- The following is not required for the application to build, but allows you to test it by issuing "mvn package jetty:run -Dspring.batch.job.enabled=false" from the command line. -->
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
@@ -358,6 +314,7 @@
|
||||
</webApp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
|
||||
<!-- Tell Maven which Java source version you want to use -->
|
||||
<plugin>
|
||||
@@ -365,7 +322,7 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
<release>8</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -385,10 +342,7 @@
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
</overlay>
|
||||
</overlays>
|
||||
|
||||
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -503,9 +457,49 @@
|
||||
</ignoredResourcePatterns>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<!-- Package the war for your preference. Use the boot profile if you prefer a single jar/war
|
||||
that can be started with and embedded application server. Default is jetty as it is assumed
|
||||
that the main users of this project already have an app server.
|
||||
Different profiles are needed as packing it for spring boot, makes the resulting war undeployable
|
||||
due to a class shading issue between tomcat and jetty.
|
||||
(the error is 'java.util.ServiceConfigurationError: org.apache.juli.logging.Log: org.eclipse.jetty.apache.jsp.JuliLog not a subtype')
|
||||
|
||||
-->
|
||||
|
||||
<!-- example of how to start the server using spring boot-->
|
||||
<!-- mvn clean package spring-boot:repackage -Pboot && java -jar target/hapi-fhir-jpaserver.war -->
|
||||
<profile>
|
||||
<id>boot</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<!-- examples of how to start the server using the default profile-->
|
||||
<!-- mvn clean package jetty:run -Dspring.batch.job.enabled=false -->
|
||||
<!-- java -jar -Dspring.batch.job.enabled=false jetty-runner.jar target/hapi-fhir-jpaserver.war -->
|
||||
<profile>
|
||||
<id>jetty</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
@@ -8,6 +8,7 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -51,7 +52,7 @@ public class AppProperties {
|
||||
private List<Bundle.BundleType> allowed_bundle_types = null;
|
||||
|
||||
private Validation validation = new Validation();
|
||||
private List<Tester> tester = new ArrayList<>();
|
||||
private List<Tester> tester = ImmutableList.of(new Tester());
|
||||
private Logger logger = new Logger();
|
||||
private Subscription subscription = new Subscription();
|
||||
private Cors cors = null;
|
||||
@@ -353,7 +354,7 @@ public class AppProperties {
|
||||
|
||||
public static class Cors {
|
||||
private Boolean allow_Credentials = true;
|
||||
private List<String> allowed_origin = new ArrayList<>();//List.of("*");
|
||||
private List<String> allowed_origin = ImmutableList.of("*");
|
||||
|
||||
public List<String> getAllowed_origin() {
|
||||
return allowed_origin;
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
@@ -14,8 +13,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ServletComponentScan(basePackageClasses = {JpaRestfulServer.class}, basePackages = "ca.uhn.fhir.jpa.starter")
|
||||
@SpringBootApplication(exclude = ElasticsearchRestClientAutoConfiguration.class)
|
||||
public class Application extends SpringBootServletInitializer {
|
||||
@@ -25,8 +22,8 @@ public class Application extends SpringBootServletInitializer {
|
||||
System.setProperty("spring.batch.job.enabled", "false");
|
||||
SpringApplication.run(Application.class, args);
|
||||
|
||||
//Server is now accessible at eg. http://localhost:8080/fhir/metadata
|
||||
//UI is now accessible at http://localhost:8080/
|
||||
//Server is now accessible at eg. http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata
|
||||
//UI is now accessible at http://localhost:8080/hapi-fhir-jpaserver/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +32,6 @@ public class Application extends SpringBootServletInitializer {
|
||||
return builder.sources(Application.class);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
AutowireCapableBeanFactory beanFactory;
|
||||
|
||||
@@ -51,7 +47,7 @@ public class Application extends SpringBootServletInitializer {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean servletRegistrationBean() {
|
||||
public ServletRegistrationBean overlayRegistrationBean() {
|
||||
|
||||
AnnotationConfigWebApplicationContext annotationConfigWebApplicationContext = new AnnotationConfigWebApplicationContext();
|
||||
annotationConfigWebApplicationContext.register(FhirTesterConfig.class);
|
||||
|
||||
@@ -9,18 +9,12 @@ import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHan
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.hl7.fhir.dstu2.model.Subscription;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.thymeleaf.util.Validate;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Driver;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -32,8 +26,6 @@ public class FhirServerConfigCommon {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext appContext;
|
||||
|
||||
public FhirServerConfigCommon(AppProperties appProperties) {
|
||||
ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny") + " contains searches");
|
||||
|
||||
@@ -4,7 +4,6 @@ import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
|
||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
//@WebServlet(urlPatterns = {"/hapi-fhir-jpaserver/fhir/*"})
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
@Import(AppProperties.class)
|
||||
public class JpaRestfulServer extends BaseJpaRestfulServer {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user