我有一個屬性文件,我想加載到系統屬性,以便我可以通過System.getProperty("myProp")
訪問它。目前,我正在嘗試使用Spring <context:propert-placeholder/>
像這樣:如何在Spring中加載系統屬性文件?
<context:property-placeholder location="/WEB-INF/properties/webServerProperties.properties" />
然而,當我嘗試通過System.getProperty("myProp")
我越來越null
訪問我的屬性。我的屬性文件看起來像這樣:
myProp=hello world
我怎麼能做到這一點?我很確定我可以設置運行時參數,但是我想避免這種情況。
謝謝!
也許[這個相關的問題(http://stackoverflow.com/questions/1311360/property-placeholder-location-from-another-property)給出了一些方向? – Raghuram 2010-11-07 06:12:17