Fix #1142 - Upgrade Spring Boot to latest version
This commit is contained in:
parent
a0cb7edd08
commit
9d3904ef3e
|
@ -28,7 +28,9 @@ import ca.uhn.fhir.rest.server.IPagingProvider;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
// Note: this class is not annotated with @Service because we want to
|
||||
// explicitly define it in BaseConfig.java. This is done so that
|
||||
// implementors can override if they want to.
|
||||
public class DatabaseBackedPagingProvider extends BasePagingProvider implements IPagingProvider {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -31,6 +31,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig;
|
|||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.provider.BaseJpaProvider;
|
||||
import ca.uhn.fhir.jpa.provider.BaseJpaSystemProvider;
|
||||
import ca.uhn.fhir.model.dstu2.resource.AuditEvent;
|
||||
import ca.uhn.fhir.okhttp.client.OkHttpRestfulClientFactory;
|
||||
import ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory;
|
||||
import ca.uhn.fhir.rest.client.api.IClientInterceptor;
|
||||
|
@ -46,6 +47,7 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
|
|||
import okhttp3.OkHttpClient;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.*;
|
||||
|
@ -69,6 +71,7 @@ import org.springframework.util.CollectionUtils;
|
|||
import javax.servlet.ServletException;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for HAPI FHIR.
|
||||
|
@ -164,26 +167,11 @@ public class FhirAutoConfiguration {
|
|||
@ConditionalOnBean(DataSource.class)
|
||||
@EnableConfigurationProperties(FhirProperties.class)
|
||||
static class FhirJpaServerConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ScheduledExecutorFactoryBean scheduledExecutorService() {
|
||||
ScheduledExecutorFactoryBean b = new ScheduledExecutorFactoryBean();
|
||||
b.setPoolSize(5);
|
||||
return b;
|
||||
}
|
||||
|
||||
@Bean(name=BaseConfig.TASK_EXECUTOR_NAME)
|
||||
public AsyncTaskExecutor taskScheduler() {
|
||||
ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler();
|
||||
retVal.setConcurrentExecutor(scheduledExecutorService().getObject());
|
||||
retVal.setScheduledExecutor(scheduledExecutorService().getObject());
|
||||
return retVal;
|
||||
}
|
||||
@Autowired
|
||||
private ScheduledExecutorService myScheduledExecutorService;
|
||||
|
||||
@Configuration
|
||||
@EntityScan(basePackages = {"ca.uhn.fhir.jpa.entity", "ca.uhn.fhir.jpa.model.entity"})
|
||||
@EnableJpaRepositories(basePackages = "ca.uhn.fhir.jpa.dao.data")
|
||||
static class FhirJpaDaoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ca.uhn.fhir.spring.boot.autoconfigure;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
|
@ -14,18 +11,19 @@ import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
|
|||
import ca.uhn.fhir.spring.boot.autoconfigure.FhirAutoConfiguration.FhirJpaServerConfiguration.Dstu3;
|
||||
import org.assertj.core.util.Arrays;
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -110,7 +108,7 @@ public class FhirAutoConfigurationTest {
|
|||
|
||||
@Test
|
||||
public void withValidations() {
|
||||
load("hapi.fhir.validation.request-only=false");
|
||||
load("hapi.fhir.validation.request-only:false");
|
||||
assertThat(this.context.getBeansOfType(IServerInterceptor.class)).hasSize(2);
|
||||
}
|
||||
|
||||
|
@ -147,8 +145,16 @@ public class FhirAutoConfigurationTest {
|
|||
}
|
||||
|
||||
private void load(Class<?>[] configs, ClassLoader classLoader, String... environment) {
|
||||
|
||||
MockEnvironment env = new MockEnvironment();
|
||||
for (String next : environment) {
|
||||
String nextKey = next.substring(0, next.indexOf(':'));
|
||||
String nextValue = next.substring(next.indexOf(':') + 1);
|
||||
env.setProperty(nextKey, nextValue);
|
||||
}
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(applicationContext, environment);
|
||||
applicationContext.setEnvironment(env);
|
||||
if (classLoader != null) {
|
||||
applicationContext.setClassLoader(classLoader);
|
||||
}
|
||||
|
|
|
@ -4,14 +4,12 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||
import org.hl7.fhir.dstu3.model.Patient;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.embedded.LocalServerPort;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
|
|
|
@ -211,18 +211,18 @@
|
|||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classFolders>
|
||||
<classFolder>${basedir}/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-client/target/classes</classFolder>
|
||||
<classFolder>${basedir}/../hapi-fhir-server/target/classes</classFolder>
|
||||
</classFolders>
|
||||
<sourceFolders>
|
||||
<sourceFolder>${basedir}/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-client/src/main/java</sourceFolder>
|
||||
<sourceFolder>${basedir}/../hapi-fhir-server/src/main/java</sourceFolder>
|
||||
</sourceFolders>
|
||||
<!--<classFolders>-->
|
||||
<!--<classFolder>${basedir}/target/classes</classFolder>-->
|
||||
<!--<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>-->
|
||||
<!--<classFolder>${basedir}/../hapi-fhir-client/target/classes</classFolder>-->
|
||||
<!--<classFolder>${basedir}/../hapi-fhir-server/target/classes</classFolder>-->
|
||||
<!--</classFolders>-->
|
||||
<!--<sourceFolders>-->
|
||||
<!--<sourceFolder>${basedir}/src/main/java</sourceFolder>-->
|
||||
<!--<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>-->
|
||||
<!--<sourceFolder>${basedir}/../hapi-fhir-client/src/main/java</sourceFolder>-->
|
||||
<!--<sourceFolder>${basedir}/../hapi-fhir-server/src/main/java</sourceFolder>-->
|
||||
<!--</sourceFolders>-->
|
||||
<dumpOnExit>true</dumpOnExit>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
@ -360,6 +360,7 @@
|
|||
<package>ca.uhn.fhir.model.dstu2</package>
|
||||
<version>dstu2</version>
|
||||
<buildDatatypes>true</buildDatatypes>
|
||||
<packageName>ca.uhn.fhir.model.dstu2</packageName>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- <execution> <id>clean_source</id> <goals> <goal>minimize-resources</goal> </goals> <configuration> <fhirVersion>DSTU2</fhirVersion> <targetDirectory>${project.baseDir}/../hapi-tinder-plugin/</targetDirectory>
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -544,7 +544,8 @@
|
|||
<slf4j_version>1.7.25</slf4j_version>
|
||||
<spring_version>5.1.3.RELEASE</spring_version>
|
||||
<spring_data_version>2.1.3.RELEASE</spring_data_version>
|
||||
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
|
||||
<!--<spring-boot.version>1.5.6.RELEASE</spring-boot.version>-->
|
||||
<spring-boot.version>2.1.1.RELEASE</spring-boot.version>
|
||||
|
||||
<stax2_api_version>3.1.4</stax2_api_version>
|
||||
<thymeleaf-version>3.0.11.RELEASE</thymeleaf-version>
|
||||
|
@ -791,7 +792,7 @@
|
|||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<li>thymeleaf-spring4 (Testpage Overlay) has been replaced with thymeleaf-spring5</li>
|
||||
<li>Commons-Lang3: 3.8 -> 3.8.1</li>
|
||||
<li>Commons-Text: 1.4 -> 1.4</li>
|
||||
<li>Spring Boot: 1.5.6.RELEASE -> 2.1.1.RELEASE</li>
|
||||
</ul>
|
||||
]]>
|
||||
</action>
|
||||
|
|
Loading…
Reference in New Issue