use of org.apache.deltaspike.core.spi.config.ConfigSource in project deltaspike by apache.
the class ConfigurationExtension method registerUserConfigSources.
@SuppressWarnings("UnusedDeclaration")
public void registerUserConfigSources(@Observes AfterDeploymentValidation adv) {
if (!isActivated) {
return;
}
// create a local copy with all the collected PropertyFileConfig
Set<Class<? extends PropertyFileConfig>> allPropertyFileConfigClasses = new HashSet<Class<? extends PropertyFileConfig>>(this.propertyFileConfigClasses);
// now add any PropertyFileConfigs from a 'parent BeanManager'
// we start with the current TCCL
ClassLoader currentClassLoader = ClassUtils.getClassLoader(null);
addParentPropertyFileConfigs(currentClassLoader, allPropertyFileConfigClasses);
// because maybe WE are a parent BeanManager ourselves!
if (!this.propertyFileConfigClasses.isEmpty()) {
detectedParentPropertyFileConfigs.put(currentClassLoader, this.propertyFileConfigClasses);
}
// collect all the ConfigSources from our PropertyFileConfigs
List<ConfigSource> configSources = new ArrayList<ConfigSource>();
for (Class<? extends PropertyFileConfig> propertyFileConfigClass : allPropertyFileConfigClasses) {
configSources.addAll(createPropertyConfigSource(propertyFileConfigClass));
}
for (final Bean bean : cdiSources) {
configSources.add(BeanProvider.getContextualReference(ConfigSource.class, bean));
}
// finally add all
ConfigResolver.addConfigSources(configSources);
for (final Bean bean : cdiFilters) {
ConfigResolver.addConfigFilter(BeanProvider.getContextualReference(ConfigFilter.class, bean));
}
processConfigurationValidation(adv);
registerConfigMBean();
logConfiguration();
}
Aggregations