Spring PropertyPlaceholderConfigurer beans

Posted by OrganicVeggie Mon, 05 May 2008 21:34:00 GMT

Multiple PropertyPlaceholderConfigurer Beans

So I found a scenario today where we had two different PropertyPlaceHolderConfigurer beans declared in two separate XML files. Unfortunately, the second property file wasn’t getting loaded, so we would get errors about Spring being unable to resolve particular properties.

I found this great post summarizing the solution:

http://dotal.wordpress.com/2007/09/14/mulitple-propertyplaceholderconfigurer-configurations/

Basically, you have to update the definition for the first PropertyPlaceHolderConfigurer bean that gets loaded and add the ignoreUnresolvablePlaceholders property:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:app.properties"/>
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>

Posted in  | Tags ,  | no comments