如下所示,直接寫多個<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" />
