在application-context.xml中配置多个property-placeholder

如下所示,直接写多个<context:property-placeholder>标签是会报错的。

    <context:property-placeholder location="classpath:wechat/official-account.properties" />
    <context:property-placeholder location="classpath:db.properties" />

即便是写在不同的xml里面,只要最终被application-context.xml的<import>标签所引入,都是会报错的。

正确的做法追加一个ignore-unresolvable属性,每个property-placeholder都需要加。

    <context:property-placeholder location="classpath:wechat/official-account.properties" ignore-unresolvable="true" />
    <context:property-placeholder location="classpath:db.properties" ignore-unresolvable="true" />
原文地址:https://www.cnblogs.com/deolin/p/7501678.html