Example usage for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreUnresolvablePlaceholders

List of usage examples for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreUnresolvablePlaceholders

Introduction

In this page you can find the example usage for org.springframework.context.support PropertySourcesPlaceholderConfigurer setIgnoreUnresolvablePlaceholders.

Prototype

public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders) 

Source Link

Document

Set whether to ignore unresolvable placeholders.

Usage

From source file:org.geosdi.geoplatform.experimental.connector.core.spring.placeholder.OAuth2CorePlaceholderConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer oauth2CorePropertyConfigurer(
        @Value("#{systemProperties['GP_DATA_DIR']}") String gpConfigDataDir,
        @Value("#{systemProperties['OAUTH2_CORE_FILE_PROP']}") String oauth2CoreFileProp)
        throws MalformedURLException {

    PropertySourcesPlaceholderConfigurer corePC = new PropertySourcesPlaceholderConfigurer();
    corePC.setPlaceholderPrefix("oauth2CoreConfigurator{");
    corePC.setPlaceholderSuffix("}");
    corePC.setNullValue("@null");

    corePC.setLocations(placeholderResourcesLoader.loadResources(gpConfigDataDir, oauth2CoreFileProp));
    corePC.setIgnoreResourceNotFound(Boolean.TRUE);
    corePC.setIgnoreUnresolvablePlaceholders(Boolean.TRUE);

    return corePC;
}

From source file:dk.nsi.haiba.lprimporter.config.LPRConfiguration.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
    propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(false);

    propertySourcesPlaceholderConfigurer
            .setLocations(new Resource[] { new ClassPathResource("default-config.properties"),
                    new ClassPathResource("lprconfig.properties") });

    return propertySourcesPlaceholderConfigurer;
}

From source file:it.cnr.missioni.connector.core.spring.placeholder.MissioniCorePlaceholderConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer oauth2CorePropertyConfigurer(
        @Value("#{systemProperties['GP_DATA_DIR']}") String gpConfigDataDir,
        @Value("#{systemProperties['MISSIONI_CORE_FILE_PROP']}") String missioniCoreFileProp)
        throws MalformedURLException {

    PropertySourcesPlaceholderConfigurer corePC = new PropertySourcesPlaceholderConfigurer();
    corePC.setPlaceholderPrefix("missioniCoreConfigurator{");
    corePC.setPlaceholderSuffix("}");
    corePC.setNullValue("@null");

    corePC.setLocations(placeholderResourcesLoader.loadResources(gpConfigDataDir, missioniCoreFileProp));
    corePC.setIgnoreResourceNotFound(Boolean.TRUE);
    corePC.setIgnoreUnresolvablePlaceholders(Boolean.TRUE);

    return corePC;
}

From source file:cn.org.once.cstack.initializer.CloudUnitApplicationContext.java

@Bean
@Profile("test")/*from   w  w w . ja v  a2s  .c  om*/
public static PropertySourcesPlaceholderConfigurer propertiesForTest() throws Exception {
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    Resource[] resources = new Resource[] { new ClassPathResource("application-test.properties") };
    pspc.setLocations(resources);
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;
}

From source file:de.thm.arsnova.config.SecurityConfig.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setLocations(new Resource[] { new ClassPathResource("arsnova.properties.example"),
            new FileSystemResource("file:///etc/arsnova/arsnova.properties"), });
    configurer.setIgnoreResourceNotFound(true);
    configurer.setIgnoreUnresolvablePlaceholders(false);

    return configurer;
}

From source file:fr.treeptik.cloudunit.initializer.CloudUnitApplicationContext.java

@Bean
@Profile("production")
public static PropertySourcesPlaceholderConfigurer propertiesForProduction() throws Exception {
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    File customFile = new File(System.getProperty("user.home") + "/.cloudunit/configuration.properties");
    Resource[] resources = null;//from   www  .  jav  a  2s  .c  om
    if (customFile.exists()) {
        resources = new Resource[] { new ClassPathResource("application-production.properties"),
                new FileSystemResource(
                        new File(System.getProperty("user.home") + "/.cloudunit/configuration.properties")) };
    } else {
        logger.error(customFile.getAbsolutePath() + " is missing. It could generate configuration error");
        resources = new Resource[] { new ClassPathResource("application-production.properties"), };
    }
    pspc.setLocations(resources);
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;
}

From source file:org.osgp.adapter.protocol.dlms.application.config.ApplicationContext.java

@Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    final PropertySourcesPlaceholderConfigurer propertySource = new PropertySourcesPlaceholderConfigurer();
    propertySource.setIgnoreUnresolvablePlaceholders(true);
    return propertySource;
}

From source file:io.gravitee.gateway.handlers.api.ApiContextHandlerFactory.java

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.getName());
    context.refresh();//  w  ww  . j  ava 2  s.c  o  m

    return context;
}

From source file:org.openhims.oauth2.configuration.PropertiesConfiguration.java

public PropertySourcesPlaceholderConfigurer getProperties() {
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    Resource[] resources = new Resource[] { new ClassPathResource("properties/application.properties"),
            new ClassPathResource("properties/server.properties") };
    pspc.setLocations(resources);/*from ww  w  .  j  av  a2s  .c o  m*/
    pspc.setIgnoreUnresolvablePlaceholders(IGNORE_UNRESOLVABLE_PLACEHOLDERS);
    pspc.setIgnoreResourceNotFound(true);
    return pspc;
}