for (Map.Entry<String, Class<?>> entry : importedResources.entrySet()) {
String resource = entry.getKey();
Class<?> readerClass = entry.getValue();
if (!readerInstanceCache.containsKey(readerClass)) {
try {
BeanDefinitionReader readerInstance = (BeanDefinitionReader)
readerClass.getConstructor(BeanDefinitionRegistry.class).newInstance(this.registry);
readerInstanceCache.put(readerClass, readerInstance);
}
catch (Exception ex) {
throw new IllegalStateException("Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
}
}
BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
// TODO SPR-6310: qualify relatively pathed locations as done in AbstractContextLoader.modifyLocations
reader.loadBeanDefinitions(resource);
}
}