use of com.kixeye.chassis.bootstrap.spring.ArchaiusSpringPropertySource in project chassis by Kixeye.
the class Application method createChildContext.
private void createChildContext() {
if (appMetadata.isWebapp()) {
applicationContext = new AnnotationConfigWebApplicationContext();
if (appMetadata.getConfigurationClasses().length > 0) {
((AnnotationConfigWebApplicationContext) applicationContext).register(appMetadata.getConfigurationClasses());
}
} else {
applicationContext = new AnnotationConfigApplicationContext();
if (appMetadata.getConfigurationClasses().length > 0) {
((AnnotationConfigApplicationContext) applicationContext).register(appMetadata.getConfigurationClasses());
}
}
applicationContext.setParent(bootstrapApplicationContext);
applicationContext.getEnvironment().getPropertySources().addFirst(new ArchaiusSpringPropertySource(appMetadata.getName() + "-archaius"));
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
configurer.setEnvironment(applicationContext.getEnvironment());
applicationContext.addBeanFactoryPostProcessor(configurer);
applicationContext.setId(appMetadata.getName());
applicationContext.refresh();
}
Aggregations