I need to load an environment-specific property file, and I’d like to be able to both set it from the JVM (using -D) and to provide a default value in the main properties file or, failing that, somewhere else (like the applicationContext.xml)
I’m using the new hotness Spring 3.1 with its unified property management, but I can’t find a lot of info on the property system.
UPDATE:
To clarify:
<context:property-placeholder location="/WEB-INF/myapp.properties,
/WEB-INF/myapp-${deploy.env}.properties"/>
You can do it using Spring 3.1, JVM property will be put into placeholders and you can define default values using “:”, for example:
where defValue is default value, it can be overridden by JVM option -Dproperty1=newValue