Fix startup issue

This commit is contained in:
James Agnew 2019-11-02 22:45:13 -04:00
parent 2bf578879a
commit f8cbd27957
2 changed files with 10 additions and 7 deletions

View File

@ -66,6 +66,7 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
@Override
protected IValueExtractor getPathValueExtractor(IBaseResource theResource, String theSinglePath) {
start(null);
return () -> {
List<IBase> values = new ArrayList<>();
List<Base> 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);
}
}

View File

@ -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());
}