R4 support for spring boot

This commit is contained in:
Andreas Keil 2018-05-03 08:26:27 +02:00
parent 34d9646d8b
commit 5552b95d99
3 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jaxrs.server.AbstractJaxRsProvider;
import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu2;
import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu3;
import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.provider.BaseJpaProvider;
import ca.uhn.fhir.jpa.provider.BaseJpaSystemProvider;
@ -221,6 +222,12 @@ public class FhirAutoConfiguration {
@ConditionalOnProperty(name = "hapi.fhir.version", havingValue = "DSTU2")
static class Dstu2 extends BaseJavaConfigDstu2 {
}
@Configuration
@ConditionalOnMissingBean(type = "ca.uhn.fhir.jpa.config.BaseConfig")
@ConditionalOnProperty(name = "hapi.fhir.version", havingValue = "R4")
static class R4 extends BaseJavaConfigR4 {
}
}
@Configuration

View File

@ -57,6 +57,9 @@ public class FhirAutoConfigurationTest {
public void withFhirVersion() throws Exception {
load("hapi.fhir.version:DSTU3");
assertThat(this.context.getBean(FhirContext.class).getVersion()).isEqualTo(FhirVersionEnum.DSTU3.getVersionImplementation());
load("hapi.fhir.version:R4");
assertThat(this.context.getBean(FhirContext.class).getVersion()).isEqualTo(FhirVersionEnum.R4.getVersionImplementation());
}
@Test

View File

@ -18,7 +18,7 @@ spring:
enabled: true
hapi:
fhir:
version: dstu3
version: r4
server:
path: /fhir/*
rest: