One more test fix

This commit is contained in:
James Agnew 2018-10-04 09:36:10 -04:00
parent c64567be68
commit 2464599a68
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ public class DaoRegistry implements ApplicationContextAware {
@Autowired @Autowired
private FhirContext myCtx; private FhirContext myCtx;
private volatile Map<String, IFhirResourceDao<?>> myResourceNameToResourceDao = new HashMap<>(); private volatile Map<String, IFhirResourceDao<?>> myResourceNameToResourceDao;
@Override @Override
public void setApplicationContext(ApplicationContext theApplicationContext) throws BeansException { public void setApplicationContext(ApplicationContext theApplicationContext) throws BeansException {
@ -47,14 +47,14 @@ public class DaoRegistry implements ApplicationContextAware {
public IFhirResourceDao<?> getResourceDao(String theResourceName) { public IFhirResourceDao<?> getResourceDao(String theResourceName) {
IFhirResourceDao<?> retVal = getResourceNameToResourceDao().get(theResourceName); IFhirResourceDao<?> retVal = getResourceNameToResourceDao().get(theResourceName);
Validate.notNull(retVal, "No DAO exists for resource type %s", theResourceName); Validate.notNull(retVal, "No DAO exists for resource type %s - Have: %s", theResourceName, myResourceNameToResourceDao);
return retVal; return retVal;
} }
private Map<String, IFhirResourceDao<?>> getResourceNameToResourceDao() { private Map<String, IFhirResourceDao<?>> getResourceNameToResourceDao() {
Map<String, IFhirResourceDao<?>> retVal = myResourceNameToResourceDao; Map<String, IFhirResourceDao<?>> retVal = myResourceNameToResourceDao;
if (retVal == null) { if (retVal == null || retVal.isEmpty()) {
retVal = new HashMap<>(); retVal = new HashMap<>();
Map<String, IFhirResourceDao> resourceDaos = myAppCtx.getBeansOfType(IFhirResourceDao.class); Map<String, IFhirResourceDao> resourceDaos = myAppCtx.getBeansOfType(IFhirResourceDao.class);
for (IFhirResourceDao nextResourceDao : resourceDaos.values()) { for (IFhirResourceDao nextResourceDao : resourceDaos.values()) {