Announcement Announcement Module
Collapse
No announcement yet.
properties and applicationContext.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • properties and applicationContext.xml

    Hi,

    I want to use 3 properties files : one for my dev, second for the integration server, and the third for my production server.

    How can i set the information in applicationContext.xml that variables like ${application.variable} must be replace by values in application.properties ?

    Is it possible to specified it in the applicationContext.xml or must i use code ?

    Code:
    PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
    cfg.setLocation(new FileSystemResource("application.properties"));
    cfg.postProcessBeanFactory(factory);
    in my code ?

    Thanks,

    Fabien.

  • #2
    Just add the following bean to your applicationContext.xml:
    Code:
    <bean id="configsetter" class="org.springrframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location"><value>application.properties</value></property>
    </bean>
    I don't think the bean id matters.

    Comment

    Working...
    X