I have two projects, one of them (Services) includes the second one (Core). I\'ve defined this PropertyPlaceholderConfigurer below within Core project:
<
You can use multiple at the same time BUT you have to have different names/ids for each else one will override the other. Next to that you need to either use different placeholders (${...}) for each or configure it to ignore unresolved placeholders.
Instead of using the class definition I strongly suggest yo use the namespace (<context:property-placeholder .. />
which saves you some xml. (It will generate beans with unique names so you can have multiple at the same time, make sure to set the ignore-unresolvable
attribute to true
.
As a last resort you could implement your a BeanDefinitionRegistryPostProcessor
which detects all PropertyPlaceHolderConfigurer
instances, merges them into one and move all the locations/resources to the merged one. That way you don't have to worry about multiple different placeholders or unresolvable properties.
try this code
<bean id="servicesPropertyConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:swagger.properties</value>
<value>classpath:appConfig.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>