在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