use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project gravitee-gateway by gravitee-io.
the class EnvironmentConfiguration 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 gravitee-gateway by gravitee-io.
the class ApiContextHandlerFactory method createApplicationContext.
AbstractApplicationContext createApplicationContext(Api api) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.setParent(gatewayApplicationContext);
context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader()));
context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment());
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
configurer.setIgnoreUnresolvablePlaceholders(true);
configurer.setEnvironment(gatewayApplicationContext.getEnvironment());
context.addBeanFactoryPostProcessor(configurer);
context.getBeanFactory().registerSingleton("api", api);
context.register(ApiHandlerConfiguration.class);
context.setId("context-api-" + api.getId());
context.refresh();
return context;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project alien4cloud by alien4cloud.
the class Bootstrap method placeHolderConfigurer.
@Bean
public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
// this to avoid errors when properties are not resolvable
// beans should use default value syntax to verify that the property exists
// @Value("${some.key:#{null}}")
configurer.setIgnoreUnresolvablePlaceholders(true);
return configurer;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project Asqatasun by Asqatasun.
the class AsqatasunTestConfig method propertySourcesPlaceholderConfigurer.
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application-test.yml"));
propertySourcesPlaceholderConfigurer.setProperties(yaml.getObject());
return propertySourcesPlaceholderConfigurer;
}
use of org.springframework.context.support.PropertySourcesPlaceholderConfigurer in project spring-boot by spring-projects.
the class PropertySourcesDeducer method getPropertySources.
PropertySources getPropertySources() {
PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer();
if (configurer != null) {
return configurer.getAppliedPropertySources();
}
MutablePropertySources sources = extractEnvironmentPropertySources();
Assert.state(sources != null, "Unable to obtain PropertySources from PropertySourcesPlaceholderConfigurer or Environment");
return sources;
}
Aggregations