亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

[Spring] 多個 PropertyPlaceholderConfigurer 導致占位符未替換問題

[Spring] 多個 PropertyPlaceholderConfigurer 導致占位符未替換問題

瀟瀟雨雨 2019-05-21 11:11:15
這是一個Spring項目,第一個PropertyPlaceholderConfigurer,在context-aaa.xml主要是配置JDBCpropertiesclasspath:jdbc.properties其中,jdbc.properties的內容如下:test.datasource.url=jdbc:mysql://192.168.0.66:3306/devtest.datasource.username=roottest.datasource.password=123456第二個PropertyPlaceholderConfigurer,在context-bbb.xml,功能是從數據里加載properties問題來了,加載DruidDataSource時,占位符并沒有被替換。我已經加了PropertyPlaceholderConfigurer的order屬性排序,以及ignoreUnresolvablePlaceholders為true了,但是問題依舊。DruidDataSource作為第二個PropertyPlaceholderConfigurer的依賴,它的配置占位符不會被處理嗎?我斷點發現,BeanFactoryPostProcessor的處理,在程序的報錯之后才執行,是怎么回事?https://jira.spring.io/browse...我找到了解決方案:Thealternativeisto(a)usethenewPropertySourcesPlaceholderConfigurerinsteadofthetraditionalPropertyPlaceholderConfigurer;(b)eliminatethefirstPropertySourcesPlaceholderConfigurer;(c)registeraPropertySourcewiththeApplicationContext'sEnvironmentthatcontainsthepropertiesfortheplaceholdersthatneedreplacementinthePropertySourcesPlaceholderConfigurer我想問第三步怎么操作?。?
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 1653 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號