diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 98fce3781df..b13edcc35da 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 3ee44897a36..1e2050bce79 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 238de5c736e..746e6e664c1 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/IHapiBootOrder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/IHapiBootOrder.java new file mode 100644 index 00000000000..27a2c5b3c82 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/IHapiBootOrder.java @@ -0,0 +1,33 @@ +package ca.uhn.fhir; + +/*- + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 - 2023 Smile CDR, Inc. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +/** + * Spring bean initialization constants. + */ +public interface IHapiBootOrder { + int ADD_JOB_DEFINITIONS = 100; + int REGISTER_INTERCEPTORS = 200; + + int SUBSCRIPTION_MATCHING_CHANNEL_HANDLER = 300; + int AFTER_SUBSCRIPTION_INITIALIZED = 310; + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java index 67c954927c0..86260defb4a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java @@ -456,8 +456,7 @@ public abstract class BaseInterceptorService impleme theInvokers.put((POINTCUT) nextPointcut, nextAddedHook); } - // Make sure we're always sorted according to the order declared in - // @Order + // Make sure we're always sorted according to the order declared in @Order for (IPointcut nextPointcut : theInvokers.keys()) { List nextInvokerList = theInvokers.get((POINTCUT) nextPointcut); nextInvokerList.sort(Comparator.naturalOrder()); diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index 11359cf12bd..8a8554894a7 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -4,14 +4,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml index e44d69c040b..b08a7edf751 100644 --- a/hapi-fhir-checkstyle/pom.xml +++ b/hapi-fhir-checkstyle/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index b5fedea1476..31c4fa52bb1 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 09d207d0c43..dd76d6eef33 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 5483d2a1eee..1f15b94df7e 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 4f0881ba65b..0b11c25bc7f 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index dcd7b55a23d..097affebf5d 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 28dedf1bae3..55b19a9789f 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 1c474cc4d90..3d448d1c47d 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 6a6ff8d5029..fea8a625d05 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 4aff8bf6685..0d5907f97b4 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 20dcdf60c48..c4bb66238c1 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index 35782cc514b..9e6f22375db 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml @@ -87,6 +87,11 @@ jboss-jaxrs-api_2.1_spec provided + + org.springframework + spring-context + ${spring_version} + com.fasterxml.woodstox diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java index 529379e375d..76a13686f22 100644 --- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java +++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java @@ -46,8 +46,9 @@ import org.hl7.fhir.dstu2.hapi.rest.server.ServerConformanceProvider; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.CapabilityStatement; import org.slf4j.LoggerFactory; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.context.event.EventListener; -import javax.annotation.PostConstruct; import javax.ws.rs.GET; import javax.ws.rs.OPTIONS; import javax.ws.rs.Path; @@ -132,11 +133,11 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv } /** - * This method will set the conformance during the postconstruct phase. The method {@link AbstractJaxRsConformanceProvider#getProviders()} is used to get all the resource providers include in the + * This method will set the conformance during the Context Refreshed phase. The method {@link AbstractJaxRsConformanceProvider#getProviders()} is used to get all the resource providers include in the * conformance */ - @PostConstruct - protected synchronized void setUpPostConstruct() { + @EventListener(ContextRefreshedEvent.class) + protected synchronized void buildCapabilityStatement() { if (myInitialized) { return; } @@ -211,7 +212,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv @GET @Path("/metadata") public Response conformance() throws IOException { - setUpPostConstruct(); + buildCapabilityStatement(); Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA); JaxRsRequest requestDetails = request.build(); diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java index 6196e398758..5354a5664b0 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java @@ -16,7 +16,8 @@ import java.net.URI; import java.util.Arrays; import java.util.concurrent.ConcurrentHashMap; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -99,7 +100,7 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest { when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo")); result.setUriInfo(uriInfo); result.setHeaders(headers); - result.setUpPostConstruct(); + result.buildCapabilityStatement(); return result; } diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java index 3259d322341..eaf56d26e28 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java @@ -5,12 +5,12 @@ import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2_1; import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2_1; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.IResourceProvider; -import javax.ws.rs.core.MultivaluedMap; import org.jboss.resteasy.specimpl.ResteasyHttpHeaders; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.net.URI; @@ -101,7 +101,7 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test { when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo")); result.setUriInfo(uriInfo); result.setHeaders(headers); - result.setUpPostConstruct(); + result.buildCapabilityStatement(); return result; } diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java index b70b9c63d92..6c8ebb7190b 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.jaxrs.server; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3; import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.IResourceProvider; @@ -15,12 +16,11 @@ import java.net.URI; import java.util.Arrays; import java.util.concurrent.ConcurrentHashMap; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3; - public class AbstractJaxRsConformanceProviderDstu3Test { private static final String BASEURI = "http://basiuri"; @@ -100,7 +100,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test { when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo")); result.setUriInfo(uriInfo); result.setHeaders(headers); - result.setUpPostConstruct(); + result.buildCapabilityStatement(); return result; } diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java index b897154483c..78725548b92 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java @@ -16,7 +16,8 @@ import java.net.URI; import java.util.Arrays; import java.util.concurrent.ConcurrentHashMap; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -99,7 +100,7 @@ public class AbstractJaxRsConformanceProviderR4Test { when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo")); result.setUriInfo(uriInfo); result.setHeaders(headers); - result.setUpPostConstruct(); + result.buildCapabilityStatement(); return result; } diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java index 5d8ad75a028..f64dbe68f4d 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java @@ -15,7 +15,8 @@ import java.net.URI; import java.util.Arrays; import java.util.concurrent.ConcurrentHashMap; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -98,7 +99,7 @@ public class AbstractJaxRsConformanceProviderTest { when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo")); result.setUriInfo(uriInfo); result.setHeaders(headers); - result.setUpPostConstruct(); + result.buildCapabilityStatement(); return result; } diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml index 39e79330c70..a2137f38b88 100644 --- a/hapi-fhir-jpa/pom.xml +++ b/hapi-fhir-jpa/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 83e456520dc..9f32dc19aef 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java index b9add15d86e..1ced9daa29f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java @@ -296,8 +296,8 @@ public class JpaConfig { } @Bean - public MemoryCacheService memoryCacheService() { - return new MemoryCacheService(); + public MemoryCacheService memoryCacheService(DaoConfig theDaoConfig) { + return new MemoryCacheService(theDaoConfig); } @Bean diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/ValidationSupportConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/ValidationSupportConfig.java index 11a72248209..2a5c824f4cf 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/ValidationSupportConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/ValidationSupportConfig.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.support.DefaultProfileValidationSupport; import ca.uhn.fhir.context.support.IValidationSupport; +import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.dao.JpaPersistedResourceValidationSupport; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChain; import ca.uhn.fhir.jpa.validation.ValidatorPolicyAdvisor; @@ -56,10 +57,10 @@ public class ValidationSupportConfig { } @Bean(name = "myInstanceValidator") - public IInstanceValidatorModule instanceValidator(FhirContext theFhirContext, CachingValidationSupport theCachingValidationSupport, ValidationSupportChain theValidationSupportChain) { + public IInstanceValidatorModule instanceValidator(FhirContext theFhirContext, CachingValidationSupport theCachingValidationSupport, ValidationSupportChain theValidationSupportChain, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) { if (theFhirContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) { FhirInstanceValidator val = new FhirInstanceValidator(theCachingValidationSupport); - val.setValidatorResourceFetcher(jpaValidatorResourceFetcher()); + val.setValidatorResourceFetcher(jpaValidatorResourceFetcher(theFhirContext, theValidationSupport, theDaoRegistry)); val.setValidatorPolicyAdvisor(jpaValidatorPolicyAdvisor()); val.setBestPracticeWarningLevel(BestPracticeWarningLevel.Warning); val.setValidationSupport(theCachingValidationSupport); @@ -74,8 +75,8 @@ public class ValidationSupportConfig { @Bean @Lazy - public ValidatorResourceFetcher jpaValidatorResourceFetcher() { - return new ValidatorResourceFetcher(); + public ValidatorResourceFetcher jpaValidatorResourceFetcher(FhirContext theFhirContext, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) { + return new ValidatorResourceFetcher(theFhirContext, theValidationSupport, theDaoRegistry); } @Bean diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java index 0c6996ba86e..dc72f6013d6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java @@ -30,7 +30,6 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Nullable; -import javax.annotation.PostConstruct; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType; @@ -95,11 +94,6 @@ public abstract class BaseHapiFhirSystemDao extends B myTransactionProcessor = theTransactionProcessor; } - @PostConstruct - public void start() { - myTransactionProcessor.setDao(this); - } - @Override @Transactional(propagation = Propagation.NEVER) public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java index 58a7cbfa0fb..8c42a24f1e3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java @@ -28,19 +28,12 @@ import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.instance.model.api.IBaseBundle; -import javax.annotation.PostConstruct; import javax.persistence.TypedQuery; import java.util.Collection; import java.util.List; public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao { - @Override - @PostConstruct - public void start() { - super.start(); - } - @Override public Meta metaGetOperation(RequestDetails theRequestDetails) { String sql = "SELECT d FROM TagDefinition d WHERE d.myId IN (SELECT DISTINCT t.myTagId FROM ResourceTag t)"; diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml index b2d12cc1f49..7b769a6a173 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index 0b5779874c8..222ec3408a7 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java index 7ff5f417e0d..3881db35da1 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java @@ -8,10 +8,8 @@ import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.log.Logs; import com.google.common.annotations.VisibleForTesting; import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; /*- @@ -38,17 +36,22 @@ import javax.annotation.PreDestroy; public class MdmQueueConsumerLoader { private static final Logger ourLog = Logs.getMdmTroubleshootingLog(); - @Autowired - private MdmMessageHandler myMdmMessageHandler; - @Autowired - private IChannelFactory myChannelFactory; - @Autowired - private IMdmSettings myMdmSettings; + private final IChannelFactory myChannelFactory; + private final IMdmSettings myMdmSettings; + private final MdmMessageHandler myMdmMessageHandler; protected IChannelReceiver myMdmChannel; - @PostConstruct - public void startListeningToMdmChannel() { + public MdmQueueConsumerLoader(IChannelFactory theChannelFactory, IMdmSettings theMdmSettings, MdmMessageHandler theMdmMessageHandler) { + myChannelFactory = theChannelFactory; + myMdmSettings = theMdmSettings; + myMdmMessageHandler = theMdmMessageHandler; + + startListeningToMdmChannel(); + } + + + private void startListeningToMdmChannel() { if (myMdmChannel == null) { ChannelConsumerSettings config = new ChannelConsumerSettings(); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmConsumerConfig.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmConsumerConfig.java index 52d4de5d573..3419effb58c 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmConsumerConfig.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmConsumerConfig.java @@ -27,7 +27,6 @@ import ca.uhn.fhir.jpa.mdm.broker.MdmMessageHandler; import ca.uhn.fhir.jpa.mdm.broker.MdmMessageKeySvc; import ca.uhn.fhir.jpa.mdm.broker.MdmQueueConsumerLoader; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; -import ca.uhn.fhir.mdm.dao.MdmLinkFactory; import ca.uhn.fhir.jpa.mdm.svc.GoldenResourceMergerSvcImpl; import ca.uhn.fhir.jpa.mdm.svc.GoldenResourceSearchSvcImpl; import ca.uhn.fhir.jpa.mdm.svc.IMdmModelConverterSvc; @@ -52,6 +51,7 @@ import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmCandidateSearchSvc; import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmGoldenResourceFindingSvc; import ca.uhn.fhir.jpa.mdm.util.MdmPartitionHelper; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; +import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory; import ca.uhn.fhir.mdm.api.IGoldenResourceMergerSvc; import ca.uhn.fhir.mdm.api.IMdmControllerSvc; import ca.uhn.fhir.mdm.api.IMdmLinkCreateSvc; @@ -63,6 +63,7 @@ import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.IMdmSurvivorshipService; import ca.uhn.fhir.mdm.batch2.MdmBatch2Config; import ca.uhn.fhir.mdm.dao.IMdmLinkImplFactory; +import ca.uhn.fhir.mdm.dao.MdmLinkFactory; import ca.uhn.fhir.mdm.interceptor.IMdmStorageInterceptor; import ca.uhn.fhir.mdm.interceptor.MdmStorageInterceptor; import ca.uhn.fhir.mdm.log.Logs; @@ -93,8 +94,8 @@ public class MdmConsumerConfig { IMdmSurvivorshipService mdmSurvivorshipService() { return new MdmSurvivorshipSvcImpl(); } @Bean - MdmQueueConsumerLoader mdmQueueConsumerLoader() { - return new MdmQueueConsumerLoader(); + MdmQueueConsumerLoader mdmQueueConsumerLoader(IChannelFactory theChannelFactory, IMdmSettings theMdmSettings, MdmMessageHandler theMdmMessageHandler) { + return new MdmQueueConsumerLoader(theChannelFactory, theMdmSettings, theMdmMessageHandler); } @Bean diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmLoader.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmLoader.java index 50779c1c925..add3a378971 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmLoader.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmLoader.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.mdm.config; * #L% */ +import ca.uhn.fhir.IHapiBootOrder; import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.provider.MdmProviderLoader; import org.slf4j.Logger; @@ -44,7 +45,7 @@ public class MdmLoader { @EventListener(classes = {ContextRefreshedEvent.class}) // This @Order is here to ensure that MatchingQueueSubscriberLoader has initialized before we initialize this. // Otherwise the MDM subscriptions won't get loaded into the SubscriptionRegistry - @Order + @Order(IHapiBootOrder.AFTER_SUBSCRIPTION_INITIALIZED) public void updateSubscriptions() { if (!myMdmSettings.isEnabled()) { return; diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/CandidateSearcher.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/CandidateSearcher.java index e15ec8eeaab..53ef3d96cd4 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/CandidateSearcher.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/CandidateSearcher.java @@ -23,11 +23,11 @@ package ca.uhn.fhir.jpa.mdm.svc.candidate; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; -import ca.uhn.fhir.mdm.svc.MdmSearchParamSvc; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.mdm.api.IMdmSettings; +import ca.uhn.fhir.mdm.svc.MdmSearchParamSvc; import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,7 +86,7 @@ public class CandidateSearcher { } public static String idOrType(IAnyResource theResource, String theResourceType) { - if (theResource.getIdElement() == null) { + if (theResource.getIdElement() == null || theResource.getIdElement().isEmpty()) { return theResourceType; } return theResource.getIdElement().toUnqualifiedVersionless().toString(); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java index 12c4bae52a4..21f9fcf5228 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java @@ -1,8 +1,6 @@ package ca.uhn.fhir.jpa.mdm.provider; -import ca.uhn.fhir.batch2.api.IJobCoordinator; import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test; -import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.test.Batch2JobHelper; import ca.uhn.fhir.mdm.api.IMdmControllerSvc; import ca.uhn.fhir.mdm.api.IMdmSubmitSvc; @@ -42,10 +40,6 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { @Autowired MessageHelper myMessageHelper; - @Autowired - private IJobCoordinator myJobCoordinator; - @Autowired - private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; private String defaultScript; protected void setMdmRuleJson(String theString) throws IOException { @@ -54,13 +48,12 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); myMdmSettings.setEnabled(true); myMdmSettings.setScriptText(json); - myMdmResourceMatcherSvc.init(); + myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings); } @BeforeEach public void before() throws Exception { myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmHelper, myMdmSubmitSvc, myMdmSettings); -// FhirContext theFhirContext, IJobCoordinator theJobCoordinator, IRequestPartitionHelperSvc theRequestPartitionHelperSvc defaultScript = myMdmSettings.getScriptText(); } @@ -69,7 +62,7 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { public void after() throws IOException { super.after(); myMdmSettings.setScriptText(defaultScript); - myMdmResourceMatcherSvc.init();// This bugger creates new objects from the beans and then ignores them. + myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings); } protected void clearMdmLinks() { diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 5f4dd6f399d..0f396428586 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 46d039ff753..5fa0d9cf16a 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java index b8b3418998e..546ae874407 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.cache; * #L% */ +import ca.uhn.fhir.IHapiBootOrder; import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.Pointcut; @@ -46,7 +47,7 @@ public class ResourceChangeListenerRegistryInterceptor { @EventListener(classes = {ContextRefreshedEvent.class}) - @Order + @Order(IHapiBootOrder.REGISTER_INTERCEPTORS) public void start() { myInterceptorBroadcaster.registerInterceptor(this); } diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index 35ba7c0c17e..33efee1e0c8 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java index d63956520d9..df8ade0e5c0 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber; +import ca.uhn.fhir.IHapiBootOrder; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import org.slf4j.Logger; @@ -7,6 +8,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; +import org.springframework.core.annotation.Order; import javax.annotation.PreDestroy; @@ -44,8 +46,9 @@ public class MatchingQueueSubscriberLoader { @Autowired private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber; - @EventListener(classes = {ContextRefreshedEvent.class}) - public void handleContextRefreshEvent() { + @EventListener(ContextRefreshedEvent.class) + @Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER) + public void subscribeToMatchingChannel() { if (myMatchingChannel == null) { myMatchingChannel = mySubscriptionChannelFactory.newMatchingReceivingChannel(SUBSCRIPTION_MATCHING_CHANNEL_NAME, null); } diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml index a0616c421e5..14bdcb8b8e1 100644 --- a/hapi-fhir-jpaserver-test-dstu2/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu2/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml index 2c8b18941c3..ea27c3f8cbf 100644 --- a/hapi-fhir-jpaserver-test-dstu3/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu3/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml index b8c8f24ab30..281606b6519 100644 --- a/hapi-fhir-jpaserver-test-r4/pom.xml +++ b/hapi-fhir-jpaserver-test-r4/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java index 1ded2805d7a..7f958f3a8d2 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java @@ -178,11 +178,9 @@ public class GiantTransactionPerfTest { myHapiTransactionService.setTransactionManager(myTransactionManager); myHapiTransactionService.setInterceptorBroadcaster(myInterceptorSvc); myHapiTransactionService.setRequestPartitionSvcForUnitTest(myRequestPartitionHelperSvc); - myHapiTransactionService.start(); myTransactionProcessor = new TransactionProcessor(); myTransactionProcessor.setContext(ourFhirContext); - myTransactionProcessor.setDao(mySystemDao); myTransactionProcessor.setTxManager(myTransactionManager); myTransactionProcessor.setEntityManagerForUnitTest(myEntityManager); myTransactionProcessor.setVersionAdapter(new TransactionProcessorVersionAdapterR4()); @@ -194,12 +192,10 @@ public class GiantTransactionPerfTest { myTransactionProcessor.setIdHelperServiceForUnitTest(myIdHelperService); myTransactionProcessor.setFhirContextForUnitTest(ourFhirContext); myTransactionProcessor.setApplicationContextForUnitTest(myAppCtx); - myTransactionProcessor.start(); mySystemDao = new FhirSystemDaoR4(); mySystemDao.setTransactionProcessorForUnitTest(myTransactionProcessor); mySystemDao.setDaoConfigForUnitTest(myDaoConfig); - mySystemDao.start(); when(myAppCtx.getBean(eq(IInstanceValidatorModule.class))).thenReturn(myInstanceValidatorSvc); when(myAppCtx.getBean(eq(IFhirSystemDao.class))).thenReturn(mySystemDao); diff --git a/hapi-fhir-jpaserver-test-r4b/pom.xml b/hapi-fhir-jpaserver-test-r4b/pom.xml index 73c3bbc6774..fe9c57cd060 100644 --- a/hapi-fhir-jpaserver-test-r4b/pom.xml +++ b/hapi-fhir-jpaserver-test-r4b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml index f15ab301d16..5718a857a03 100644 --- a/hapi-fhir-jpaserver-test-r5/pom.xml +++ b/hapi-fhir-jpaserver-test-r5/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index ef5fd382091..f05a501c6c4 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java index d6ca6835a6a..167ae699814 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java @@ -39,8 +39,7 @@ class MemoryCacheServiceTest { public void setUp() { DaoConfig daoConfig = new DaoConfig(); daoConfig.setMassIngestionMode(false); - mySvc = new MemoryCacheService(); - mySvc.myDaoConfig = daoConfig; + mySvc = new MemoryCacheService(daoConfig); } @Test @@ -50,7 +49,6 @@ class MemoryCacheServiceTest { String code = "t"; MemoryCacheService.TagDefinitionCacheKey cacheKey = new MemoryCacheService.TagDefinitionCacheKey(type, system, code); - mySvc.start(); TagDefinition retVal = mySvc.getIfPresent(MemoryCacheService.CacheEnum.TAG_DEFINITION, cacheKey); assertThat(retVal, nullValue()); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 40c9f8d9474..68079a1e7fa 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index 6281f775627..87ae31997c0 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/rules/svc/MdmResourceMatcherSvc.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/rules/svc/MdmResourceMatcherSvc.java index 500acbe4f9a..f504d5a2912 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/rules/svc/MdmResourceMatcherSvc.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/rules/svc/MdmResourceMatcherSvc.java @@ -33,10 +33,8 @@ import ca.uhn.fhir.mdm.rules.json.MdmFieldMatchJson; import ca.uhn.fhir.mdm.rules.json.MdmRulesJson; import org.hl7.fhir.instance.model.api.IBaseResource; import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; @@ -51,19 +49,22 @@ public class MdmResourceMatcherSvc { private static final Logger ourLog = Logs.getMdmTroubleshootingLog(); private final FhirContext myFhirContext; - private final IMdmSettings myMdmSettings; private MdmRulesJson myMdmRulesJson; private final List myFieldMatchers = new ArrayList<>(); - @Autowired - public MdmResourceMatcherSvc(FhirContext theFhirContext, IMdmSettings theMdmRules) { + public MdmResourceMatcherSvc(FhirContext theFhirContext, IMdmSettings theMdmSettings) { myFhirContext = theFhirContext; - myMdmSettings = theMdmRules; + + setMdmSettings(theMdmSettings); } - @PostConstruct - public void init() { - myMdmRulesJson = myMdmSettings.getMdmRules(); + public void setMdmSettings(IMdmSettings theMdmSettings) { + myMdmRulesJson = theMdmSettings.getMdmRules(); + + addFieldMatchers(); + } + + private void addFieldMatchers() { if (myMdmRulesJson == null) { throw new ConfigurationException(Msg.code(1521) + "Failed to load MDM Rules. If MDM is enabled, then MDM rules must be available in context."); } @@ -71,7 +72,6 @@ public class MdmResourceMatcherSvc { for (MdmFieldMatchJson matchFieldJson : myMdmRulesJson.getMatchFields()) { myFieldMatchers.add(new MdmResourceFieldMatcher( myFhirContext, matchFieldJson, myMdmRulesJson)); } - } /** diff --git a/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/BaseR4Test.java b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/BaseR4Test.java index 2597d2ad3f1..337f0f1afa9 100644 --- a/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/BaseR4Test.java +++ b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/BaseR4Test.java @@ -35,9 +35,7 @@ public abstract class BaseR4Test { } protected MdmResourceMatcherSvc buildMatcher(MdmRulesJson theMdmRulesJson) { - MdmResourceMatcherSvc retval = new MdmResourceMatcherSvc(ourFhirContext, new MdmSettings(new MdmRuleValidator(ourFhirContext, mySearchParamRetriever)).setMdmRules(theMdmRulesJson)); - retval.init(); - return retval; + return new MdmResourceMatcherSvc(ourFhirContext, new MdmSettings(new MdmRuleValidator(ourFhirContext, mySearchParamRetriever)).setMdmRules(theMdmRulesJson)); } protected void assertMatch(MdmMatchResultEnum theExpectedMatchEnum, MdmMatchOutcome theMatchResult) { diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index 745e3383578..17a218f8ff2 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index c31bc5b0cb6..6b5d5458e65 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml index c5d6191700d..790e4451e21 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml index 4a518ebba4e..84bd29dd098 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml @@ -20,7 +20,7 @@ ca.uhn.hapi.fhir hapi-fhir-caching-api - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT com.github.ben-manes.caffeine diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml index 5b32bcfc77b..62742ca5449 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml index 7e723f50d22..77d5680b976 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml @@ -7,7 +7,7 @@ hapi-fhir ca.uhn.hapi.fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../pom.xml diff --git a/hapi-fhir-serviceloaders/pom.xml b/hapi-fhir-serviceloaders/pom.xml index 40a02580640..5113c4e1226 100644 --- a/hapi-fhir-serviceloaders/pom.xml +++ b/hapi-fhir-serviceloaders/pom.xml @@ -5,7 +5,7 @@ hapi-fhir ca.uhn.hapi.fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index a2098096e98..bdeab65c74e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index 98ace25d353..5b8d1998e69 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index 1e8eabdb8c7..f8853ec0a25 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 0568c214cb8..68597d71563 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index 6c811741608..b224d8e826e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index cc3401f4095..1c090a45924 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index e30a2a62050..d051b6e02cf 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml index 5106876c529..e0143bd2d04 100644 --- a/hapi-fhir-sql-migrate/pom.xml +++ b/hapi-fhir-sql-migrate/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml index b04c1751162..45617d0688e 100644 --- a/hapi-fhir-storage-batch2-jobs/pom.xml +++ b/hapi-fhir-storage-batch2-jobs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml index fdbd7790d39..bc3ec9ef3b4 100644 --- a/hapi-fhir-storage-batch2/pom.xml +++ b/hapi-fhir-storage-batch2/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/Batch2JobRegisterer.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/Batch2JobRegisterer.java index 7e564902488..67d0cba7009 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/Batch2JobRegisterer.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/Batch2JobRegisterer.java @@ -20,14 +20,17 @@ package ca.uhn.fhir.batch2.config; * #L% */ +import ca.uhn.fhir.IHapiBootOrder; import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; import ca.uhn.fhir.batch2.model.JobDefinition; import ca.uhn.fhir.jpa.batch.log.Logs; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.core.annotation.Order; -import javax.annotation.PostConstruct; import java.util.Map; public class Batch2JobRegisterer { @@ -37,7 +40,12 @@ public class Batch2JobRegisterer { private ApplicationContext myApplicationContext; - @PostConstruct + // The timing of this call is sensitive. It needs to be called after all the job definition beans have been created + // but before any jobs are run. E.g. ValidationDataInitializerSvcImpl can start a REINDEX job, so we use an EventListener + // so we know all the JobDefinition beans have been created, but we use @Order(IHapiBootOrder.ADD_JOB_DEFINITIONS) to ensure it is called + // before any other EventListeners that might start a job. + @EventListener(classes = ContextRefreshedEvent.class) + @Order(IHapiBootOrder.ADD_JOB_DEFINITIONS) public void start() { Map batchJobs = myApplicationContext.getBeansOfType(JobDefinition.class); JobDefinitionRegistry jobRegistry = myApplicationContext.getBean(JobDefinitionRegistry.class); diff --git a/hapi-fhir-storage-cr/pom.xml b/hapi-fhir-storage-cr/pom.xml index 170ecac7dcb..1d4188b53a4 100644 --- a/hapi-fhir-storage-cr/pom.xml +++ b/hapi-fhir-storage-cr/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java index 0f61dcfe9be..b11f6cd6204 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.cr.common.CodeCacheResourceChangeListener; +import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor; import ca.uhn.fhir.cr.common.CqlForkJoinWorkerThreadFactory; import ca.uhn.fhir.cr.common.ElmCacheResourceChangeListener; import ca.uhn.fhir.cr.common.HapiFhirDal; @@ -36,12 +37,12 @@ import ca.uhn.fhir.cr.common.ILibraryLoaderFactory; import ca.uhn.fhir.cr.common.ILibraryManagerFactory; import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory; import ca.uhn.fhir.cr.common.ITerminologyProviderFactory; -import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; +import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory; import org.cqframework.cql.cql2elm.CqlTranslatorOptions; import org.cqframework.cql.cql2elm.LibraryManager; import org.cqframework.cql.cql2elm.LibrarySourceProvider; @@ -99,8 +100,8 @@ public abstract class BaseClinicalReasoningConfig { } @Bean - CrProviderLoader cqlProviderLoader() { - return new CrProviderLoader(); + CrProviderLoader cqlProviderLoader(FhirContext theFhirContext, ResourceProviderFactory theResourceProviderFactory, CrProviderFactory theCqlProviderFactory) { + return new CrProviderLoader(theFhirContext, theResourceProviderFactory, theCqlProviderFactory); } @Bean diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProviderLoader.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProviderLoader.java index e96faadea2e..ffc243d62be 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProviderLoader.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProviderLoader.java @@ -26,26 +26,27 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; - /** * This class loads and registers CQL provider factory for clinical reasoning into hapi-fhir central provider factory **/ @Service public class CrProviderLoader { private static final Logger myLogger = LoggerFactory.getLogger(CrProviderLoader.class); - @Autowired - private FhirContext myFhirContext; - @Autowired - private ResourceProviderFactory myResourceProviderFactory; - @Autowired - private CrProviderFactory myCqlProviderFactory; + private final FhirContext myFhirContext; + private final ResourceProviderFactory myResourceProviderFactory; + private final CrProviderFactory myCqlProviderFactory; - @PostConstruct - public void loadProvider() { + public CrProviderLoader(FhirContext theFhirContext, ResourceProviderFactory theResourceProviderFactory, CrProviderFactory theCqlProviderFactory) { + myFhirContext = theFhirContext; + myResourceProviderFactory = theResourceProviderFactory; + myCqlProviderFactory = theCqlProviderFactory; + + loadProvider(); + } + + private void loadProvider() { switch (myFhirContext.getVersion().getVersion()) { case DSTU3: case R4: diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderLoaderDstu3Test.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderLoaderDstu3Test.java index 636dd163e79..0c652f1f34e 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderLoaderDstu3Test.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderLoaderDstu3Test.java @@ -19,7 +19,6 @@ class CrProviderLoaderDstu3Test extends BaseCrDstu3Test { @Test public void testContextLoads() { - myCrProviderLoader.loadProvider(); myResourceProviderFactory.createProviders(); ourLog.info("The CqlProviderLoader loaded and was able to create Providers."); } diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/CqlProviderLoaderR4Test.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/CqlProviderLoaderR4Test.java index 4552d05f891..95964eac4d1 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/CqlProviderLoaderR4Test.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/CqlProviderLoaderR4Test.java @@ -22,7 +22,6 @@ public class CqlProviderLoaderR4Test extends BaseCrR4Test { @Test public void contextLoads() { - myCqlProviderLoader.loadProvider(); myResourceProviderFactory.createProviders(); ourLog.info("The CqlProviderLoader loaded and was able to create Providers."); } diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml index b5202ff661d..038511d6199 100644 --- a/hapi-fhir-storage-mdm/pom.xml +++ b/hapi-fhir-storage-mdm/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java index ab9e4c11d3e..8ef1ada45b4 100644 --- a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java @@ -50,7 +50,7 @@ public class MdmSubmitterInterceptorLoader { private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader; @PostConstruct - public void start() { + public void loadInterceptors() { if (!myMdmSettings.isEnabled()) { return; } diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmBatch2Config.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmBatch2Config.java index 64d81ffabad..f441b418989 100644 --- a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmBatch2Config.java +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmBatch2Config.java @@ -23,14 +23,14 @@ package ca.uhn.fhir.mdm.batch2; import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; import ca.uhn.fhir.batch2.model.JobDefinition; import ca.uhn.fhir.mdm.batch2.clear.MdmClearAppCtx; +import ca.uhn.fhir.mdm.batch2.clear.MdmClearJobParameters; import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; +import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitJobParameters; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import javax.annotation.PostConstruct; - import static ca.uhn.fhir.mdm.batch2.clear.MdmClearAppCtx.MDM_CLEAR_JOB_BEAN_NAME; import static ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx.MDM_SUBMIT_JOB_BEAN_NAME; @@ -40,17 +40,10 @@ import static ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx.MDM_SUBMIT_JOB_BEAN_ MdmSubmitAppCtx.class }) public class MdmBatch2Config { - @Autowired - JobDefinitionRegistry myJobDefinitionRegistry; - - @Autowired - ApplicationContext myApplicationContext; - - @PostConstruct - public void start() { - JobDefinition clearJobDefinition = myApplicationContext.getBean(MDM_CLEAR_JOB_BEAN_NAME, JobDefinition.class); - myJobDefinitionRegistry.addJobDefinitionIfNotRegistered(clearJobDefinition); - JobDefinition submitJobDefinition = myApplicationContext.getBean(MDM_SUBMIT_JOB_BEAN_NAME, JobDefinition.class); - myJobDefinitionRegistry.addJobDefinitionIfNotRegistered(submitJobDefinition); + @Bean + MdmJobDefinitionLoader mdmJobDefinitionLoader(JobDefinitionRegistry theJobDefinitionRegistry, + @Qualifier(MDM_CLEAR_JOB_BEAN_NAME) JobDefinition theClearJobDefinition, + @Qualifier(MDM_SUBMIT_JOB_BEAN_NAME) JobDefinition theSubmitJobDefinition) { + return new MdmJobDefinitionLoader(theJobDefinitionRegistry, theClearJobDefinition, theSubmitJobDefinition); } } diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmJobDefinitionLoader.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmJobDefinitionLoader.java new file mode 100644 index 00000000000..bbc1845876b --- /dev/null +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/MdmJobDefinitionLoader.java @@ -0,0 +1,36 @@ +package ca.uhn.fhir.mdm.batch2; + +/*- + * #%L + * hapi-fhir-storage-mdm + * %% + * Copyright (C) 2014 - 2023 Smile CDR, Inc. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; +import ca.uhn.fhir.batch2.model.JobDefinition; +import ca.uhn.fhir.mdm.batch2.clear.MdmClearJobParameters; +import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitJobParameters; + +public class MdmJobDefinitionLoader { + public MdmJobDefinitionLoader(JobDefinitionRegistry theJobDefinitionRegistry, + JobDefinition theClearJobDefinition, + JobDefinition theSubmitJobDefinition) { + + theJobDefinitionRegistry.addJobDefinitionIfNotRegistered(theClearJobDefinition); + theJobDefinitionRegistry.addJobDefinitionIfNotRegistered(theSubmitJobDefinition); + } +} diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/clear/MdmClearAppCtx.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/clear/MdmClearAppCtx.java index 3a1f8399943..df3f5bf2f8f 100644 --- a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/clear/MdmClearAppCtx.java +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/clear/MdmClearAppCtx.java @@ -33,7 +33,6 @@ import org.springframework.context.annotation.Configuration; @Configuration public class MdmClearAppCtx { - public static final String JOB_MDM_CLEAR = "MDM_CLEAR"; public static final String MDM_CLEAR_JOB_BEAN_NAME = "mdmClearJobDefinition"; @@ -83,4 +82,5 @@ public class MdmClearAppCtx { public LoadGoldenIdsStep loadGoldenIdsStep(IGoldenResourceSearchSvc theGoldenResourceSearchSvc) { return new LoadGoldenIdsStep(theGoldenResourceSearchSvc); } + } diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml index 2543992030b..e3380df9dc6 100644 --- a/hapi-fhir-storage-test-utilities/pom.xml +++ b/hapi-fhir-storage-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml index 101748fb648..f15afa5c757 100644 --- a/hapi-fhir-storage/pom.xml +++ b/hapi-fhir-storage/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/binstore/FilesystemBinaryStorageSvcImpl.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/binstore/FilesystemBinaryStorageSvcImpl.java index d083771a7e2..25daa4dd4c2 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/binstore/FilesystemBinaryStorageSvcImpl.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/binstore/FilesystemBinaryStorageSvcImpl.java @@ -40,7 +40,6 @@ import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import javax.annotation.PostConstruct; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -67,10 +66,11 @@ public class FilesystemBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl { myJsonSerializer = new ObjectMapper(); myJsonSerializer.setSerializationInclusion(JsonInclude.Include.NON_NULL); myJsonSerializer.enable(SerializationFeature.INDENT_OUTPUT); + + createBasePathDirectory(); } - @PostConstruct - public void start() { + private void createBasePathDirectory() { ourLog.info("Starting binary storage service with base path: {}", myBasePath); mkdir(myBasePath); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index ee0aadab8ce..aac2fd419be 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -108,8 +108,20 @@ import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; import javax.annotation.Nonnull; -import javax.annotation.PostConstruct; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -129,7 +141,6 @@ public abstract class BaseTransactionProcessor { public static final Pattern UNQUALIFIED_MATCH_URL_START = Pattern.compile("^[a-zA-Z0-9_]+="); public static final Pattern INVALID_PLACEHOLDER_PATTERN = Pattern.compile("[a-zA-Z]+:.*"); private static final Logger ourLog = LoggerFactory.getLogger(BaseTransactionProcessor.class); - private BaseStorageDao myDao; @Autowired private PlatformTransactionManager myTxManager; @Autowired @@ -173,11 +184,6 @@ public abstract class BaseTransactionProcessor { myVersionAdapter = theVersionAdapter; } - @PostConstruct - public void start() { - ourLog.trace("Starting transaction processor"); - } - private TaskExecutor getTaskExecutor() { if (myExecutor == null) { myExecutor = myThreadPoolFactory.newThreadPool(myDaoConfig.getBundleBatchPoolSize(), myDaoConfig.getBundleBatchMaxPoolSize(), "bundle-batch-"); @@ -311,10 +317,6 @@ public abstract class BaseTransactionProcessor { return theRes.getMeta().getLastUpdated(); } - public void setDao(BaseStorageDao theDao) { - myDao = theDao; - } - private IBaseBundle processTransactionAsSubRequest(RequestDetails theRequestDetails, IBaseBundle theRequest, String theActionName, boolean theNestedMode) { BaseStorageDao.markRequestAsProcessingSubRequest(theRequestDetails); try { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/tx/HapiTransactionService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/tx/HapiTransactionService.java index 6a78b74b1e0..1ac6a1c6bed 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/tx/HapiTransactionService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/tx/HapiTransactionService.java @@ -56,7 +56,6 @@ import org.springframework.transaction.support.TransactionTemplate; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import javax.annotation.PostConstruct; import java.util.concurrent.Callable; /** @@ -74,18 +73,13 @@ public class HapiTransactionService implements IHapiTransactionService { protected PlatformTransactionManager myTransactionManager; @Autowired protected IRequestPartitionHelperSvc myRequestPartitionHelperSvc; - private boolean myCustomIsolationSupported; + private volatile Boolean myCustomIsolationSupported; @VisibleForTesting public void setInterceptorBroadcaster(IInterceptorBroadcaster theInterceptorBroadcaster) { myInterceptorBroadcaster = theInterceptorBroadcaster; } - @PostConstruct - public void start() { - myCustomIsolationSupported = isCustomIsolationSupported(); - } - @Override public IExecutionBuilder withRequest(@Nullable RequestDetails theRequestDetails) { return new ExecutionBuilder(theRequestDetails); @@ -162,11 +156,15 @@ public class HapiTransactionService implements IHapiTransactionService { } public boolean isCustomIsolationSupported() { - if (myTransactionManager instanceof JpaTransactionManager) { - JpaDialect jpaDialect = ((JpaTransactionManager) myTransactionManager).getJpaDialect(); - return (jpaDialect instanceof HibernateJpaDialect); + if (myCustomIsolationSupported == null) { + if (myTransactionManager instanceof JpaTransactionManager) { + JpaDialect jpaDialect = ((JpaTransactionManager) myTransactionManager).getJpaDialect(); + myCustomIsolationSupported = (jpaDialect instanceof HibernateJpaDialect); + } else { + myCustomIsolationSupported = false; + } } - return false; + return myCustomIsolationSupported; } @VisibleForTesting @@ -281,7 +279,7 @@ public class HapiTransactionService implements IHapiTransactionService { txTemplate.setPropagationBehavior(theExecutionBuilder.myPropagation.value()); } - if (myCustomIsolationSupported && theExecutionBuilder.myIsolation != null && theExecutionBuilder.myIsolation != Isolation.DEFAULT) { + if (isCustomIsolationSupported() && theExecutionBuilder.myIsolation != null && theExecutionBuilder.myIsolation != Isolation.DEFAULT) { txTemplate.setIsolationLevel(theExecutionBuilder.myIsolation.value()); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamSubmitInterceptorLoader.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamSubmitInterceptorLoader.java index a1cfcb789bf..32c68169bc9 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamSubmitInterceptorLoader.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamSubmitInterceptorLoader.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.searchparam.submit.interceptor; * #L% */ +import ca.uhn.fhir.IHapiBootOrder; import ca.uhn.fhir.interceptor.api.IInterceptorService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +38,7 @@ public class SearchParamSubmitInterceptorLoader { private IInterceptorService myInterceptorRegistry; @EventListener(classes = {ContextRefreshedEvent.class}) - @Order + @Order(IHapiBootOrder.REGISTER_INTERCEPTORS) public void start() { ourLog.info("Registering SearchParamValidatingInterceptor interceptor"); myInterceptorRegistry.registerInterceptor(mySearchParamValidatingInterceptor); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java index b0c342575a3..cef7f02513d 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java @@ -25,15 +25,12 @@ import ca.uhn.fhir.jpa.api.model.TranslationQuery; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.sl.cache.Cache; import ca.uhn.fhir.sl.cache.CacheFactory; -import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronizationManager; import javax.annotation.Nonnull; -import javax.annotation.PostConstruct; import java.util.Collection; import java.util.EnumMap; import java.util.Map; @@ -52,16 +49,16 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; // TODO: JA2 extract an interface for this class and use it everywhere public class MemoryCacheService { - @Autowired - DaoConfig myDaoConfig; + private final DaoConfig myDaoConfig; + private final EnumMap> myCaches = new EnumMap<>(CacheEnum.class); - private EnumMap> myCaches; + public MemoryCacheService(DaoConfig theDaoConfig) { + myDaoConfig = theDaoConfig; - @PostConstruct - public void start() { - - myCaches = new EnumMap<>(CacheEnum.class); + populateCaches(); + } + private void populateCaches() { for (CacheEnum next : CacheEnum.values()) { long timeoutSeconds; @@ -94,7 +91,6 @@ public class MemoryCacheService { myCaches.put(next, nextCache); } - } @@ -188,11 +184,6 @@ public class MemoryCacheService { return getCache(theCache).estimatedSize(); } - @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; - } - public enum CacheEnum { TAG_DEFINITION(TagDefinitionCacheKey.class), diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java index d2d83d37814..c3b9591bf67 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java @@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.validation; * #L% */ -import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.rest.api.server.RequestDetails; @@ -40,9 +40,7 @@ import org.hl7.fhir.r5.utils.validation.IResourceValidator; import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.PostConstruct; import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; @@ -52,16 +50,15 @@ public class ValidatorResourceFetcher implements IValidatorResourceFetcher { private static final Logger ourLog = LoggerFactory.getLogger(ValidatorResourceFetcher.class); - @Autowired - private DaoRegistry myDaoRegistry; - @Autowired - private FhirContext myFhirContext; - @Autowired - private IValidationSupport myValidationSupport; - private VersionSpecificWorkerContextWrapper myVersionSpecificContextWrapper; + private final FhirContext myFhirContext; + private final IValidationSupport myValidationSupport; + private final DaoRegistry myDaoRegistry; + private final VersionSpecificWorkerContextWrapper myVersionSpecificContextWrapper; - @PostConstruct - public void start() { + public ValidatorResourceFetcher(FhirContext theFhirContext, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) { + myFhirContext = theFhirContext; + myValidationSupport = theValidationSupport; + myDaoRegistry = theDaoRegistry; myVersionSpecificContextWrapper = VersionSpecificWorkerContextWrapper.newVersionSpecificWorkerContextWrapper(myValidationSupport); } diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index 45aef6d8ace..b2bdabe7622 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 0ec1b7a2a30..02ac70f962c 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index 6f6dda320fe..14fb7f0d813 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index df77c61d797..94a22154c6a 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index 604da5cf298..1db0983de46 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4b/pom.xml b/hapi-fhir-structures-r4b/pom.xml index 1c40cfa62ce..c9c83a5c925 100644 --- a/hapi-fhir-structures-r4b/pom.xml +++ b/hapi-fhir-structures-r4b/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index 953a87dbb25..0fee365e3d2 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index 46e0c2046c3..100230b37a1 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index b6ed312ccb2..5cd4a53514b 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/FhirTesterMvcConfig.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/FhirTesterMvcConfig.java index cc429ff8a8e..a1e8b4698e0 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/FhirTesterMvcConfig.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/FhirTesterMvcConfig.java @@ -2,12 +2,14 @@ package ca.uhn.fhir.to; import ca.uhn.fhir.to.mvc.AnnotationMethodHandlerAdapterConfigurer; import ca.uhn.fhir.to.util.WebUtil; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; import org.thymeleaf.spring5.view.ThymeleafViewResolver; @@ -49,8 +51,8 @@ public class FhirTesterMvcConfig extends WebMvcConfigurerAdapter { } @Bean - public AnnotationMethodHandlerAdapterConfigurer annotationMethodHandlerAdapterConfigurer() { - return new AnnotationMethodHandlerAdapterConfigurer(); + public AnnotationMethodHandlerAdapterConfigurer annotationMethodHandlerAdapterConfigurer(@Qualifier("requestMappingHandlerAdapter") RequestMappingHandlerAdapter theAdapter) { + return new AnnotationMethodHandlerAdapterConfigurer(theAdapter); } @Bean diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/AnnotationMethodHandlerAdapterConfigurer.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/AnnotationMethodHandlerAdapterConfigurer.java index 43a126767d2..3d15577fac7 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/AnnotationMethodHandlerAdapterConfigurer.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/AnnotationMethodHandlerAdapterConfigurer.java @@ -1,19 +1,13 @@ package ca.uhn.fhir.to.mvc; -import javax.annotation.PostConstruct; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; public class AnnotationMethodHandlerAdapterConfigurer { - - @Autowired - @Qualifier("requestMappingHandlerAdapter") - private RequestMappingHandlerAdapter adapter; + private final RequestMappingHandlerAdapter myAdapter; - @PostConstruct - public void init() { - adapter.setWebBindingInitializer(new ToBindingInitializer()); + public AnnotationMethodHandlerAdapterConfigurer(RequestMappingHandlerAdapter theAdapter) { + myAdapter = theAdapter; + + myAdapter.setWebBindingInitializer(new ToBindingInitializer()); } -} \ No newline at end of file +} diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 69799b9b6d0..d5955377df3 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 6935871c449..3c39e5d7097 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index d1db4500a47..3045397a24a 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 3b0f4882715..0aefb312d9b 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index 7a9e8b1b910..5ab967b8d86 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index 6867b0a1c0f..26d8e8ddd15 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 40febdbcb6b..4209ef59617 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index ef2e2337210..c93493b22e0 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 80dc65eed9d..9206627778a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io @@ -2128,7 +2128,7 @@ ca.uhn.hapi.fhir hapi-fhir-checkstyle - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index d93af36b8e9..5945725f74a 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 136ce7ab531..8ca23e0f212 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index c49e28c4009..c019d3dab10 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.3.11-SNAPSHOT + 6.3.12-SNAPSHOT ../../pom.xml