I have a properties file which I would like loaded in to System Properties so that I can access it via System.getProperty("myProp"). Currently, I’m trying to use the Spring <context:propert-placeholder/> like so:
<context:property-placeholder location="/WEB-INF/properties/webServerProperties.properties" />
However, when I try to access my properties via System.getProperty("myProp") I’m getting null. My properties file looks like this:
myProp=hello world
How could I achieve this? I’m pretty sure I could set a runtime argument, however I’d like to avoid this.
Thanks!
While I subscribe to the Spirit of Bozho’s answer, I recently also had a situation where I needed to set System Properties from Spring. Here’s the class I came up with:
Java Code:
Spring Config: