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

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

Introduction

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

Prototype

public void setLocation(Resource location) 

Source Link

Document

Set a location of a properties file to be loaded.

Usage

From source file:se.kth.csc.config.ApplicationConfig.java

/**
 * The provider for placeholders that lets us use {@link org.springframework.beans.factory.annotation.Value}
 * annotations elsewhere in the application.
 *//*from ww w. j  av a2 s .  c om*/
@Bean
public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer(Environment environment) {
    PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();

    // Load properties from "settings.properties"
    ppc.setLocation(new ClassPathResource("/settings.properties"));

    log.info("Creating placeholder configurer based on \"settings.properties\" file");
    return ppc;
}

From source file:com.open.license.config.ContextConfig.java

@Bean
public PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
    log.info("[START:Load Application Properties]");

    String propertiesFilename = "/application-" + APP_ENV + ".properties";

    PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setLocation(new ClassPathResource(propertiesFilename));
    log.info("[ACTIVATE:Profile " + APP_ENV + "]");
    log.info("[END:Load Application Properties]");

    // Start ActiveMQ Broker if enabled
    startActiveMqBroker();//from   ww w.  j  a v a 2  s.  co m
    return configurer;
}

From source file:com.github.cherimojava.orchidae.config.WebMvcConfig.java

@Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
    configurer.setLocation(new FileSystemResource(new File("./application.properties")));
    return configurer;
}

From source file:ru.elcor.mis.scheduler.config.AppConfig.java

@Bean
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer();
    Properties Props = new Properties();
    Props.setProperty("cron", "0-59/2 * * * * *");
    properties.setProperties(Props);/*w w  w.  j ava2  s  .  c  o m*/
    properties.setLocation(new ClassPathResource("scheduler.properties"));
    properties.setIgnoreResourceNotFound(false);

    return properties;
}