日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網(wǎng)站首頁 編程語言 正文

如何定義多個context:property-placeholder配置

作者:Terence Wang 更新時間: 2022-04-05 編程語言

今天在配置多配置文件的時候偶然發(fā)現(xiàn)如果我使用

<context:property-placeholder location="classpath:jdbc.properties"/>

<context:property-placeholder location="classpath:freemarker.properties"/>//這個進行多行編寫配置文件的時候會出現(xiàn)后面那個文件出現(xiàn)讀取不到的問題

這樣會導致后面那個配置文件失效

原因:Spring 只會加載第一個context:property-placeholder配置后面的文件將不會再次進行加載,所以導致后面的文件讀取不到

解決辦法:

<context:property-placeholder ignore-unresolvable="true" location="classpath:jdbc.properties,classpath:filePath.properties"/>

加入一個ignore-unresolvable="true"屬性,將文件用,隔開就可以了

原文鏈接:https://terence.blog.csdn.net/article/details/122646144

欄目分類
最近更新