From f8cbd27957d712b86073eb996a92ab5ba4588efb Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sat, 2 Nov 2019 22:45:13 -0400 Subject: [PATCH] Fix startup issue --- .../searchparam/extractor/SearchParamExtractorDstu3.java | 8 +++++--- .../searchparam/extractor/SearchParamExtractorR4.java | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java index 235596aae03..4f1d2bfee61 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java @@ -66,6 +66,7 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen @Override protected IValueExtractor getPathValueExtractor(IBaseResource theResource, String theSinglePath) { + start(null); return () -> { List values = new ArrayList<>(); List allValues = myFhirPathEngine.evaluate((Base) theResource, theSinglePath); @@ -80,10 +81,11 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen @EventListener public void start(ContextRefreshedEvent theEvent) { if (myValidationSupport == null) { - myValidationSupport = myApplicationContext.getBean(IValidationSupport.class); + IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class); + IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport); + myFhirPathEngine = new FHIRPathEngine(worker); + myValidationSupport = support; } - IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport); - myFhirPathEngine = new FHIRPathEngine(worker); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java index a54e3c24789..1a4d67b5a16 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java @@ -71,11 +71,12 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements @PostConstruct public void initFhirPath() { if (myValidationSupport == null) { - myValidationSupport = myApplicationContext.getBean(IValidationSupport.class); + IValidationSupport support = myApplicationContext.getBean(IValidationSupport.class); + IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport); + myFhirPathEngine = new FHIRPathEngine(worker); + myFhirPathEngine.setHostServices(new SearchParamExtractorR4HostServices()); + myValidationSupport = support; } - IWorkerContext worker = new HapiWorkerContext(getContext(), myValidationSupport); - myFhirPathEngine = new FHIRPathEngine(worker); - myFhirPathEngine.setHostServices(new SearchParamExtractorR4HostServices()); }