Java Code Examples for org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#setIgnoreUnresolvablePlaceholders()

The following examples show how to use org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#setIgnoreUnresolvablePlaceholders() . 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: ChildApplicationContextFactory.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * The Constructor.
 * 
 * @param properties
 *            the properties
 * @param compositeProperties
 *            the composite properties
 * @throws BeansException
 *             the beans exception
 */
private ChildApplicationContext(Properties properties,
        Map<String, Map<String, CompositeDataBean>> compositeProperties) throws BeansException
{
    super(getContextResourcePatterns(), false, ChildApplicationContextFactory.this.getParent());

    this.compositeProperties = compositeProperties;

    // Add a property placeholder configurer, with the subsystem-scoped default properties
    PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
    configurer.setPropertiesArray(new Properties[] {ChildApplicationContextFactory.this.getPropertyDefaults(), properties});
    configurer.setIgnoreUnresolvablePlaceholders(true);
    configurer.setSearchSystemEnvironment(false);
    addBeanFactoryPostProcessor(configurer);

    setClassLoader(ChildApplicationContextFactory.this.getParent().getClassLoader());
}
 
Example 2
Source File: RootConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer(){
	final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
	ppc.setLocation(new ClassPathResource("application.properties"));
	ppc.setIgnoreUnresolvablePlaceholders(true);
	return ppc;
}
 
Example 3
Source File: RootConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() {
	PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
	ppc.setLocation(new ClassPathResource("application.properties"));
	ppc.setIgnoreUnresolvablePlaceholders(true);
	return ppc;
}
 
Example 4
Source File: RootConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() {
    final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    ppc.setLocation(new ClassPathResource("application.properties"));
    ppc.setIgnoreUnresolvablePlaceholders(true);
    return ppc;
}
 
Example 5
Source File: RootConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() {
    PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    ppc.setLocation(new ClassPathResource("application.properties"));
    ppc.setIgnoreUnresolvablePlaceholders(true);
    return ppc;
}
 
Example 6
Source File: RootConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer getPropertyPlaceholderConfigurer() {
    final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    ppc.setLocation(new ClassPathResource("application.properties"));
    ppc.setIgnoreUnresolvablePlaceholders(true);
    return ppc;
}
 
Example 7
Source File: WebApplicationConfig.java    From jim-framework with Apache License 2.0 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer properties() {
    SpringPropertyInjectSupport springPropertyInjectSupport=new SpringPropertyInjectSupport();
    springPropertyInjectSupport.setConfigNameSpaces("configcenter/"+System.getProperty("env"));
    springPropertyInjectSupport.init();
    PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    Resource[] resources = new ClassPathResource[]
            { new ClassPathResource( "application.properties" ) };
    ppc.setLocations( resources );
    ppc.setIgnoreUnresolvablePlaceholders( true );
    return ppc;
}
 
Example 8
Source File: SpringUtils.java    From onetwo with Apache License 2.0 5 votes vote down vote up
public static PropertyPlaceholderConfigurer newApplicationConf(boolean searchSystemEnvironment, String... locations){
	Assert.notEmpty(locations);
	PropertyPlaceholderConfigurer ppc = new JFishPropertyPlaceholder();
	ppc.setIgnoreResourceNotFound(true);
	ppc.setIgnoreUnresolvablePlaceholders(true);
	ppc.setSearchSystemEnvironment(searchSystemEnvironment);
	List<Resource> resources = new ArrayList<Resource>();
	for(String path : locations){
		resources.add(new ClassPathResource(path));
	}
	ppc.setLocations(resources.toArray(new Resource[resources.size()]));
	return ppc;
}
 
Example 9
Source File: CoreAppConfig.java    From logsniffer with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns a general properties placeholder configurer based on
 * {@link #logSnifferProperties()}.
 * 
 * @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;
}
 
Example 10
Source File: PropertyPlaceholderConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public static PropertyPlaceholderConfigurer properties() {
    PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
    Resource[] resources = new ClassPathResource[]{ new ClassPathResource("foo.properties") };
    ppc.setLocations( resources );
    ppc.setIgnoreUnresolvablePlaceholders( true );
    return ppc;
}