在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" />

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM