Is there anyway to configure the placeholder for an optional property?
For example
<contextroperty-placeholder location="classpath:order.properties"/>
<bean id="orderProperty" class="com.foo.MyOrderProperty">
<property name="orderEnabled" value="${OrderEnabled}"/>
<property name="orderUrl" value="${orderUrl}"/>
</bean>
Our order.properties doesn't have property orderEnabled, it is on purpose, since orderEnabled always needs to be true by default. Only for very rare cases, we might need to set it to false.
However, PropertyPlaceholderConfigurer would throw exception due to the missing property.
Invalid bean definition with name 'orderProperty' defined in class path resource [applicationContext-service.xml]: Could not resolve placeholder 'OrderEnabled'
I tried add an attribute ignore-unresolvable="true" for property-placeholder. But that did not help either.
<contextroperty-placeholder location="classpath:order.properties" ignore-unresolvable="true"/>
Any suggestions on how to handle this case?
Thanks


roperty-placeholder location="classpath:order.properties"/>
Reply With Quote