I want to load multiple properties files using <util:properties>
tag in a spring 3 application.
I searched on the blogs, but cannot get the correct path to do this.
Hopefully somebody give me the answer to overcome this problem.
Actually <util:properties>
is just convenient tag for org.springframework.beans.factory.config.PropertiesFactoryBean
. And PropertiesFactoryBean
does support multiple locations.
So it is possible to create bean with Properties
this way:
<bean id="myProps" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:myprops-common.properties</value>
<value>classpath:myprops-override.properties</value>
<value>classpath:some-more-props-here.properties</value>
</list>
</property>
</bean>
My solution
<context:property-placeholder location="classpath*:*.properties,file:/some/other/path/*.properties" />
util:properties seems to support only 1 properties file (reference). You might want to use the configuration suggested by @peperg.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With