Feb 1st, 2006, 02:38 PM
How-to have different applicationContext.xml files
Can someone tell me if there is a clean way to be able to load different applicationContext.xml files depending on the hostname?
I am running on a local, development, test, and production environment, but I only want to deploy one war file....
Can I subclass the spring servlet and have it choose the applicationContext there... or something similar?
Thanks in Advance!!!
Feb 1st, 2006, 03:20 PM
Check out PropertyPlaceHolderConfigurer.
The idea is to have different property files for each environment.
In the 'locations' property, you can use the classpath: notation to specify which property files to use. This is all in the manual, check it out.
Feb 1st, 2006, 04:01 PM
Thanks for the info. That looks like exactly what I need...
Still, I need to know how I would be able to load this on startup. The servlet and contextloaderlistener are loaded by my web.xml. I can do the grunt work obviously, but would I be correct in saying that i would probably need to subclass the contextloaderlistener?