在application-context.xml中配置多个property-placeholder
Posted Deolin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在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" />
以上是关于在application-context.xml中配置多个property-placeholder的主要内容,如果未能解决你的问题,请参考以下文章
SpringMVC之application-context.xml,了解数据库相关配置
SpringMVC之application-context.xml,了解数据库相关配置
在 Spring MVC 应用程序中读取 application-context.xml 的最佳方法是添加 init-param 标签还是添加 context-param 标签?