List of usage examples for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setIgnoreUnresolvablePlaceholders
public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders)
From source file:edu.chalmers.dat076.moviefinder.config.ApplicationConfig.java
@Bean public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() { PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); ppc.setLocation(new ClassPathResource("application.properties")); ppc.setIgnoreUnresolvablePlaceholders(true); return ppc;/*from w ww.java2 s.com*/ }
From source file:ch.tatool.app.util.ContextUtils.java
/** * Create a new BeanFactory using the main ApplicationContext as parent. * //from ww w. j av a2s . c o m * @param classpath the path to the bean definition file in the classpath * @param properties set of properties that should be replaced in the definitions * @return a BeanFactory instance */ public static BeanFactory createBeanFactory(String classpath, Properties properties) { // create an empty bean factory DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); // load the context file - has to be done here, otherwise properties won't get resolved XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); Resource resource = new ClassPathResource(classpath); reader.loadBeanDefinitions(resource); // apply the properties to the context PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); configurer.setProperties(properties); configurer.setIgnoreUnresolvablePlaceholders(false); configurer.setIgnoreResourceNotFound(false); configurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_FALLBACK); configurer.postProcessBeanFactory(beanFactory); return beanFactory; }
From source file:com.iopr.DBResource.java
@Bean public static PropertyPlaceholderConfigurer properties() { PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); Resource[] resources = new ClassPathResource[] { new ClassPathResource("db.properties") }; ppc.setLocations(resources);/*from www . j a va 2 s . c o m*/ ppc.setIgnoreUnresolvablePlaceholders(true); return ppc; }
From source file:com.logsniffer.app.CoreAppConfig.java
/** * Returns a general properties placeholder configurer based on * {@link #logSnifferProperties()}.//from ww w . j ava 2s . c o m * * @param props * autowired logSnifferProperties bean * @return A general properties placeholder configurer. * @throws IOException */ @Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) @Autowired public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer( @Qualifier(BEAN_LOGSNIFFER_PROPS) final Properties props) throws IOException { final PropertyPlaceholderConfigurer c = new PropertyPlaceholderConfigurer(); c.setIgnoreResourceNotFound(true); c.setIgnoreUnresolvablePlaceholders(true); c.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); c.setProperties(props); return c; }
From source file:com.alejandroszlv.mock.repository.config.RepositoryConfig.java
@Bean public static PropertyPlaceholderConfigurer properties() { PropertyPlaceholderConfigurer properties = new PropertyPlaceholderConfigurer(); ClassPathResource[] resources = new ClassPathResource[] { new ClassPathResource("db.properties") }; properties.setLocations(resources);/*from ww w .ja v a2 s .c om*/ properties.setIgnoreUnresolvablePlaceholders(true); return properties; }
From source file:stormy.pythian.service.spring.PyhtianProperties.java
@Bean public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); propertyPlaceholderConfigurer.setLocations(new Resource[] { // new ClassPathResource("redis-config.properties"), // new ClassPathResource("pythian-config.properties") // });/*w w w. java 2s . c o m*/ propertyPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(false); return propertyPlaceholderConfigurer; }
From source file:com.thinkbiganalytics.metadata.sla.TestConfiguration.java
@Bean public PropertyPlaceholderConfigurer jiraPropertiesConfigurer() { PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); configurer.setLocations(new ClassPathResource("/conf/sla.email.properties")); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setIgnoreResourceNotFound(true); return configurer; }
From source file:gov.nih.nci.integration.dao.CommonPropsConfig.java
/** * Loads properties from classpath//from w w w .j a v a 2 s. c om * * @return the property place holder configures */ @Bean public PropertyPlaceholderConfigurer commonPropertyPlaceholderConfigurer() { final PropertyPlaceholderConfigurer configurer = new CommonsPropertyPlaceholderConfigurer("ihub", "transcend-ihub.properties"); configurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; }
From source file:com.aspose.showcase.qrcodegen.web.config.AppConfigProperties.java
@Bean public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer(); propertyPlaceholderConfigurer.setLocation(new ClassPathResource("config.properties")); // Allow for other PropertyPlaceholderConfigurer instances. propertyPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true); return propertyPlaceholderConfigurer; }
From source file:gov.nih.nci.integration.dao.CommonPropsTestConfig.java
/** * Loads properties from classpath// w ww . j a va 2 s. c om * * @return the property place holder configures */ @Bean public PropertyPlaceholderConfigurer commonPropertyPlaceholderConfigurer() { final PropertyPlaceholderConfigurer configurer = new CommonsPropertyPlaceholderConfigurer("ihub", "transcend-ihub-test.properties"); configurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; }