Example usage for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setLocalOverride

List of usage examples for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setLocalOverride

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setLocalOverride.

Prototype

public void setLocalOverride(boolean localOverride) 

Source Link

Document

Set whether local properties override properties from files.

Usage

From source file:guru.qas.martini.jmeter.config.DefaultApplicationContextBuilder.java

protected void setEnvironment(ConfigurableApplicationContext context, Properties properties) {
    PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
    configurer.setProperties(properties);
    configurer.setLocalOverride(true);
    configurer.setSearchSystemEnvironment(true);
    configurer.setSystemPropertiesMode(SYSTEM_PROPERTIES_MODE_FALLBACK);
    context.addBeanFactoryPostProcessor(configurer);
}

From source file:org.araneaframework.ioc.spring.SimpleAraneaSpringDispatcherServlet.java

public void init() throws ServletException {
    beanFactory = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());

    rootConf = new XmlBeanFactory(
            new ClassPathResource("spring-property-conf/property-custom-webapp-aranea-conf.xml"), beanFactory);
    PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
    cfg.setLocation(new ClassPathResource("spring-property-conf/default-aranea-conf.properties"));

    Properties localConf = new Properties();
    try {// w w  w .j a v  a  2 s.  com
        if (getServletContext().getResource("/WEB-INF/aranea-conf.properties") != null)
            localConf.load(getServletContext().getResourceAsStream("/WEB-INF/aranea-conf.properties"));
    } catch (IOException e) {
        throw new ServletException(e);
    }
    cfg.setProperties(localConf);
    cfg.setLocalOverride(true);

    cfg.postProcessBeanFactory(rootConf);

    super.init();
}