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

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