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

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

Introduction

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

Prototype

public void setLocalOverride(boolean localOverride) 

Source Link

Document

Set whether local properties override properties from files.

Usage

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

@Bean
@Profile("vagrant")
public static PropertySourcesPlaceholderConfigurer properties() throws Exception {
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    Resource[] resources = new Resource[] { new ClassPathResource("application-vagrant.properties") };
    pspc.setLocations(resources);//from   w  w  w. j  av a  2s .  c om
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;
}

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

@Bean
@Profile("integration")
public static PropertySourcesPlaceholderConfigurer propertiesForIntegration() throws Exception {
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    Resource[] resources = new Resource[] { new ClassPathResource("application-integration.properties") };
    pspc.setLocations(resources);/*  w ww.j  a  v  a  2 s . co  m*/
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;
}

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

@Bean
@Profile("vagrant")
public static PropertySourcesPlaceholderConfigurer properties() throws Exception {
    String file = "application-vagrant.properties";
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    pspc.setLocations(getResources(file));
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;//from  www.  ja v a 2  s . c om
}

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

@Bean
@Profile("production")
public static PropertySourcesPlaceholderConfigurer propertiesForProduction() throws Exception {
    String file = "application-production.properties";
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    pspc.setLocations(getResources(file));
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;//from   w  w w .  j a  va2  s .  c  o m
}

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

@Bean
@Profile("vagrant-demo")
public static PropertySourcesPlaceholderConfigurer propertiesForDemo() throws Exception {
    String file = "application-vagrant-demo.properties";
    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    pspc.setLocations(getResources(file));
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;//from   ww w . j av a  2s  .  c  o m
}

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

@Bean
@Profile("integration")
public static PropertySourcesPlaceholderConfigurer propertiesForIntegration() throws Exception {
    String file = "application-integration-local.properties";

    String envIntegration = System.getenv("CLOUDUNIT_JENKINS_CI");
    if ("true".equalsIgnoreCase(envIntegration)) {
        file = "application-integration.properties";
    }/*from   w w  w.  jav a2 s  . c  o  m*/

    PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
    pspc.setLocations(getResources(file));
    pspc.setIgnoreUnresolvablePlaceholders(true);
    pspc.setLocalOverride(true);
    return pspc;
}

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

@Bean
@Profile("test")//from w w  w . j a v a  2s.c  o  m
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: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;//  w  ww.j  a  va 2s.co m
    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.shaigor.rest.retro.service.impl.WordsSereviceTestConfig.java

@Bean
public PropertySourcesPlaceholderConfigurer properties() {
    PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
    ppc.setLocalOverride(true);
    String filenamePrefix = determineFilename("words").startsWith(SRC_PATH) ? "src." : "classes.";
    org.springframework.core.io.Resource[] resources = new ClassPathResource[] {
            new ClassPathResource(filenamePrefix + WORDS_SERVICE_PROPERTIES) };
    ppc.setLocations(resources);/*from  www .  j a  v a2s .c o  m*/
    return ppc;
}