diff --git a/pom.xml b/pom.xml index cc21fc7..e368bc4 100644 --- a/pom.xml +++ b/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"> 4.0.0 - @@ -248,18 +239,7 @@ jetty-webapp test - + - - org.springframework.boot - spring-boot-starter-logging - 2.3.3.RELEASE - test + ${spring.boot} @@ -347,6 +302,7 @@ + @@ -365,7 +322,7 @@ maven-compiler-plugin 3.8.1 - 11 + 8 @@ -385,10 +342,7 @@ hapi-fhir-testpage-overlay - - false - @@ -503,9 +457,49 @@ - - + + + + + + + boot + + + org.springframework.boot + spring-boot-starter-web + 2.3.3.RELEASE + + + + + + + + jetty + + + org.springframework.boot + spring-boot-starter-web + 2.3.3.RELEASE + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index b8613b4..a18abf4 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -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 allowed_bundle_types = null; private Validation validation = new Validation(); - private List tester = new ArrayList<>(); + private List 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 allowed_origin = new ArrayList<>();//List.of("*"); + private List allowed_origin = ImmutableList.of("*"); public List getAllowed_origin() { return allowed_origin; diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java index d773ad9..e8decb9 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/Application.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/Application.java @@ -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); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java index 28aab92..cfe9bde 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java @@ -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"); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java index 68190ec..d0ac06f 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java @@ -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; diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java index 773cc32..c895c22 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java @@ -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 {