Blind Squirrel

Once in a while, even a blind squirrel finds a nut.

Spring 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:

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

<bean id="mailProps" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="location" value=""/>
         <property name="ignoreUnresolvablePlaceholders" value="true"/>