Oct 27th, 2005, 10:16 AM
Loading environment specific properties
i build my Spring app as a web application and deploy to one of 3 environments. Each time i build the war file (always on my local windows machine) I have to tweak certain properties so that Ant builds the right property files and places them inside the war.
This technique works but is getting tedious as i build for different environments each day.
An alternative is to have all the properties available to the application and then to load the correct property file. Without Spring, I would probably do something like this:
1. String hostname=java.net.InetAddress.getLocalHost().getHo stName();
2. look for a properties resource with that name in the classpath.
Since I am using Spring, I was wondering if there was a more elegent solution to this already. Perhaps some intervention with the bean factory on start up to something to configure the app.
Any ideas appreciated.
Oct 27th, 2005, 02:30 PM