One more test fix
This commit is contained in:
parent
c64567be68
commit
2464599a68
|
@ -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()) {
|
||||||
|
|
Loading…
Reference in New Issue