PDA

View Full Version : properties and applicationContext.xml


fmourioux
Sep 24th, 2004, 06:37 AM
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 ?

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

Thanks,

Fabien.

cmgharris
Sep 24th, 2004, 06:46 AM
Just add the following bean to your applicationContext.xml:
<bean id="configsetter" class="org.springrframework.beans.factory.config.Property PlaceholderConfigurer">
<property name="location"><value>application.properties</value></property>
</bean>

I don't think the bean id matters.