use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project spring-boot by spring-projects.
the class ConfigurationPropertiesBindingPostProcessor method deducePropertySources.
private PropertySources deducePropertySources() {
PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer();
if (configurer != null) {
// Flatten the sources into a single list so they can be iterated
return new FlatPropertySources(configurer.getAppliedPropertySources());
}
if (this.environment instanceof ConfigurableEnvironment) {
MutablePropertySources propertySources = ((ConfigurableEnvironment) this.environment).getPropertySources();
return new FlatPropertySources(propertySources);
}
// empty, so not very useful, but fulfils the contract
logger.warn("Unable to obtain PropertySources from " + "PropertySourcesPlaceholderConfigurer or Environment");
return new MutablePropertySources();
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project gravitee-management-rest-api by gravitee-io.
the class RestConfiguration method properties.
@Bean
public static PropertySourcesPlaceholderConfigurer properties(@Qualifier("graviteeProperties") Properties graviteeProperties) {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertySourcesPlaceholderConfigurer.setProperties(graviteeProperties);
propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);
return propertySourcesPlaceholderConfigurer;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project tutorials by eugenp.
the class WebConfig method propertySourcesPlaceholderConfigurer.
// beans
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
ppc.setIgnoreUnresolvablePlaceholders(true);
return ppc;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project tutorials by eugenp.
the class ServiceConfig method propertySourcesPlaceholderConfigurer.
// beans
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
ppc.setIgnoreUnresolvablePlaceholders(true);
return ppc;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project ma-core-public by infiniteautomation.
the class MangoRestSpringConfiguration method propertySourcesPlaceholderConfigurer.
/**
* TODO EXPERIMENTAL SUPPORT FOR PROPERTY CONFIGURATION IN ANNOTATIONS Setup
* properties to be used in the Spring templates
*
* @return
*/
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
// note the static method! important!!
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
Resource[] resources = new ClassPathResource[] { new ClassPathResource("env.properties") };
configurer.setLocations(resources);
configurer.setIgnoreUnresolvablePlaceholders(true);
// Create and add any properties for Spring Annotations
Properties properties = new Properties();
configurer.setProperties(properties);
return configurer;
}
Aggregations