From d8542899e533e9ffe3acbd48a678b0fd8a24d125 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 1 Sep 2020 09:54:50 -0400 Subject: [PATCH] Don't lazy load DAOs (#2061) * Don't lazy load DAOs * More tweaks --- .../java/ca/uhn/fhir/jpa/dao/DaoSearchParamProvider.java | 6 +++++- .../src/main/resources/vm/jpa_spring_beans_java.vm | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoSearchParamProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoSearchParamProvider.java index 07bb9b36c4c..43ec62b07a9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoSearchParamProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoSearchParamProvider.java @@ -44,6 +44,10 @@ public class DaoSearchParamProvider implements ISearchParamProvider { @Override public int refreshCache(SearchParamRegistryImpl theSearchParamRegistry, long theRefreshInterval) { - return theSearchParamRegistry.doRefresh(theRefreshInterval); + int retVal = 0; + if (myDaoRegistry.getResourceDao("SearchParameter") != null) { + retVal = theSearchParamRegistry.doRefresh(theRefreshInterval); + } + return retVal; } } diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm index b5d92105b10..4a2b7483772 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm @@ -51,8 +51,7 @@ public abstract class BaseJavaConfig${versionCapitalized} extends ca.uhn.fhir.jp #foreach ( $res in $resources ) @Bean(name="my${res.name}Dao${versionCapitalized}", autowire=Autowire.BY_NAME) - @Lazy - public + public #if ( ${versionCapitalized} == 'Dstu2' && ${res.name} == 'ValueSet' ) IFhirResourceDaoValueSet #elseif ( ${versionCapitalized} == 'Dstu3' && ${res.name} == 'ValueSet' )