Results 1 to 2 of 2

Thread: properties and applicationContext.xml

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Carlisle, UK
    Posts
    184

    Default

    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.
    Chris Harris
    Carlisle, UK

Similar Threads

  1. FlowExecutionStorage in a DB
    By cacho in forum Web Flow
    Replies: 7
    Last Post: Oct 19th, 2009, 03:36 PM
  2. Hibernate Properties as JMX
    By FelderR in forum Container
    Replies: 1
    Last Post: Jul 4th, 2005, 04:59 AM
  3. Replies: 0
    Last Post: May 8th, 2005, 02:15 AM
  4. Shared properties within application context
    By milosh in forum Architecture
    Replies: 5
    Last Post: Nov 16th, 2004, 08:29 AM
  5. Replies: 19
    Last Post: Oct 20th, 2004, 11:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •