如何在應(yīng)用程序上下文中讀取系統(tǒng)環(huán)境變量?我想要的東西:<util:properties id="dbProperties" location="classpath:config_DEV/db.properties" />要么<util:properties id="dbProperties" location="classpath:config_QA/db.properties" />取決于環(huán)境。我的應(yīng)用程序上下文中可以有這樣的東西嗎?<util:properties id="dbProperties" location="classpath:config_${systemProperties.env}/db.properties" />其中實(shí)際的val是根據(jù)SYSTEM ENVIRONMENT VARIABLE設(shè)置的我正在使用Spring 3.0
3 回答

青春有我
TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超8個(gè)贊
看看這篇文章。它為您提供了幾種方法,通過PropertyPlaceholderConfigurer它支持外部屬性(通過systemPropertiesMode屬性)。
添加回答
舉報(bào)
0/150
提交
取消