use of com.cloud.spring.module.context.ResourceApplicationContext in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method getDefaultsContext.
protected ApplicationContext getDefaultsContext() {
final URL config = DefaultModuleDefinitionSet.class.getResource(DEFAULT_CONFIG_XML);
final ResourceApplicationContext context = new ResourceApplicationContext(new UrlResource(config));
context.setApplicationName("/defaults");
context.refresh();
final List<Resource> resources = (List<Resource>) context.getBean(DEFAULT_CONFIG_RESOURCES);
withModule((def, parents) -> {
for (final Resource defaults : def.getConfigLocations()) {
resources.add(defaults);
}
});
configProperties = (Properties) context.getBean(DEFAULT_CONFIG_PROPERTIES);
for (final Resource resource : resources) {
load(resource, configProperties);
}
for (final Resource resource : (Resource[]) context.getBean(MODULE_PROPERITES)) {
load(resource, configProperties);
}
parseExcludes();
return context;
}
use of com.cloud.spring.module.context.ResourceApplicationContext in project cosmic by MissionCriticalCloud.
the class DefaultModuleDefinitionSet method loadContext.
protected ApplicationContext loadContext(final ModuleDefinition def, final ApplicationContext parent) {
final ResourceApplicationContext context = new ResourceApplicationContext();
context.setApplicationName("/" + def.getName());
final Resource[] resources = getConfigResources(def.getName());
context.setConfigResources(resources);
context.setParent(parent);
context.setClassLoader(def.getClassLoader());
final long start = System.currentTimeMillis();
if (log.isInfoEnabled()) {
for (final Resource resource : resources) {
log.info("Loading module context [{}] from {}", def.getName(), resource);
}
}
context.refresh();
log.info("Loaded module context [{}] in {} ms", def.getName(), (System.currentTimeMillis() - start));
contexts.put(def.getName(), context);
return context;
}
Aggregations