Java Code Examples for org.springframework.context.support.PropertySourcesPlaceholderConfigurer#getAppliedPropertySources()

The following examples show how to use org.springframework.context.support.PropertySourcesPlaceholderConfigurer#getAppliedPropertySources() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertySourcesDeducer.java    From spring-cloud-gray with Apache License 2.0 5 votes vote down vote up
public PropertySources getPropertySources() {
    PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer();
    if (configurer != null) {
        return configurer.getAppliedPropertySources();
    }
    MutablePropertySources sources = extractEnvironmentPropertySources();
    if (sources != null) {
        return sources;
    }
    throw new IllegalStateException("Unable to obtain PropertySources from "
            + "PropertySourcesPlaceholderConfigurer or Environment");
}
 
Example 2
Source File: EagleBeanFactoryPostProcessor.java    From eagle with Apache License 2.0 5 votes vote down vote up
private PropertySources deducePropertySources(DefaultListableBeanFactory beanFactory) {
    PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer(beanFactory);
    if (configurer != null) {
        return new FlatPropertySources(configurer.getAppliedPropertySources());
    }
    if (this.environment instanceof ConfigurableEnvironment) {
        MutablePropertySources propertySources = ((ConfigurableEnvironment) this.environment)
                .getPropertySources();
        return new FlatPropertySources(propertySources);
    }
    return new MutablePropertySources();
}
 
Example 3
Source File: MangoConfigFactory.java    From mango-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
public static PropertySources getPropertySources(DefaultListableBeanFactory beanFactory) {
    PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer(beanFactory);
    if (configurer != null) {
        return configurer.getAppliedPropertySources();
    }
    MutablePropertySources sources = extractEnvironmentPropertySources(beanFactory);
    if (sources != null) {
        return sources;
    }
    throw new IllegalStateException("Unable to obtain PropertySources from "
                                            + "PropertySourcesPlaceholderConfigurer or Environment");
}