I have an ApplicationContext.xml file with the following node:
<context:property-placeholder
location="classpath:hibernate.properties, classpath:pathConfiguration.properties" />
It specifies that both properties files will be used by my application.
Inside pathConfiguration.properties, some paths are defined, such as:
PATH_ERROR=/xxx/yyy/error
PATH_SUCCESS=/xxx/yyy/success
A PathConfiguration bean has setters for each path.
The problem is: when some of those mandatory paths are not defined, no error is thrown. How and where should I handle this problem?
The standard behaviour of the PropertyPlaceholder that is configured via
<context:property-placeholder ... />throws an exception when a property cannot be resolved once it is required in some place as long as you do not configure it otherwise.For your case if you have a Bean that requires some properties like this, it will fail when the value cannot be resolved. For example like this:
If you want to relax the PropertyPlaceholder and don’t make it throw an Exception when a property cannot be resolved you can configure the PropertyPlaceholder to ignore unresolvable properties like this
<context:property-placeholder ignore-unresolvable="true" ... />.