use of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in project spring-framework by spring-projects.
the class FormattingConversionServiceTests method formatFieldForAnnotationWithPlaceholdersAndFactoryBean.
@Test
@SuppressWarnings("resource")
public void formatFieldForAnnotationWithPlaceholdersAndFactoryBean() throws Exception {
GenericApplicationContext context = new GenericApplicationContext();
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
Properties props = new Properties();
props.setProperty("dateStyle", "S-");
props.setProperty("datePattern", "M-d-yy");
ppc.setProperties(props);
context.registerBeanDefinition("formattingService", new RootBeanDefinition(FormattingConversionServiceFactoryBean.class));
context.getBeanFactory().registerSingleton("ppc", ppc);
context.refresh();
formattingService = context.getBean("formattingService", FormattingConversionService.class);
doTestFormatFieldForAnnotation(ModelWithPlaceholders.class, false);
}
use of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in project jaffa-framework by jaffa-projects.
the class PropertyPlaceholderConfig method conversionService.
/**
* Load the properties files used in application contexts here
*
* @return the initialized instance of the PropertyPlaceholderConfigurer class
*/
@Bean(name = "properties")
@Scope(BeanDefinition.SCOPE_SINGLETON)
public PropertyPlaceholderConfigurer conversionService() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
Resource resource1 = new ClassPathResource("application_file_1.properties");
Resource resource2 = new ClassPathResource("application_file_2.properties");
configurer.setLocations(resource1, resource2);
return configurer;
}
use of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in project kylo by Teradata.
the class DefaultConfiguration method createConfiguration.
private ConfigurableListableBeanFactory createConfiguration(String location) {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
Resource[] resources = new FileSystemResource[] { new FileSystemResource(location) };
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
ppc.setLocations(resources);
ppc.setIgnoreUnresolvablePlaceholders(true);
ppc.setSearchSystemEnvironment(false);
ppc.postProcessBeanFactory(factory);
return factory;
}
use of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in project kylo by Teradata.
the class TestConfiguration method jiraPropertiesConfigurer.
@Bean
public PropertyPlaceholderConfigurer jiraPropertiesConfigurer() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setLocations(new ClassPathResource("/conf/sla.email.properties"));
configurer.setIgnoreUnresolvablePlaceholders(true);
configurer.setIgnoreResourceNotFound(true);
return configurer;
}
use of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer in project kylo by Teradata.
the class DeveloperJiraConfiguration method jiraPropertiesConfigurer.
@Bean(name = "jiraProperties")
public PropertyPlaceholderConfigurer jiraPropertiesConfigurer() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setLocations(new ClassPathResource("/conf/jira.properties"));
configurer.setIgnoreUnresolvablePlaceholders(true);
configurer.setIgnoreResourceNotFound(true);
return configurer;
}
Aggregations