I am working on a Spring 3.0.5 web application that accesses LDAP and two databases. I have a properties with configuration information for the LDAP server and that databases, in applicationContext-security.xml and dispatcher-servlet.xml, but I would like to make it so each server can have different data properties without changing a file in the WAR. Can I somehow put a file somewhere else on the server and still access it from within my application?
I am working on a Spring 3.0.5 web application that accesses LDAP and two
Share
Add this to your context
This will load the properties file located at ${envfile}, a variable you can set with Java’s startup paramater like this
Or maybe in Tomcat’s startup script
Values can be retrieved in your controllers using Springs Value annotation like this:
Please note that these features require Spring 3.1, more information here
Good luck!