I’m trying to make my application backwards compatible to at least one previous version. The biggest issue I’m having is expected properties that don’t exist in the old properties file.
For instance, let’s say the old properties file looks like this:
prop.old=some text
The new properties file looks like this:
prop.old=some text
prop.new=some new text
And the relevant section of the new app-context.xml looks like this:
<beans:bean id="myClass" class="com.mycompany.MyClass">
<beans:property name="oldThing" value="${prop.old}" />
<beans:property name="newThing" value="${prop.new}" />
</beans:bean>
Obviously, this will blow up at runtime. Is there a way to check if the property exists and, if it doesn’t, using an empty string instead?
Since 3.0 you can use ignore-unresolvable=true in
PropertyPlaceholderConfigurer