|
|
DAO paths relative to Tomcat installation
Working with a spring app that requires access to dynamic configuration and data files, I need to make sure that all path references are relative to the tomcat installation of the machine the app is running on. I've installed the app on a number of machines with different OS's, with different root paths to Tomcat. In each case I have to change a set of beans in my applicationContext.xml file to reflect the installed path reference, for example-
Code:
Installation A-
lt;property name=quot;dataDirquot;gt;lt;valuegt;/Server/Tomcat/webapps/myapp/WEB-INF/data/conf/lt;/valuegt;lt;/propertygt;
Instalation B-
lt;property name=quot;dataDirquot;gt;lt;valuegt;/Apps/Tools/Tomcat/webapps/myapp/WEB-INF/data/conf/lt;/valuegt;lt;/propertygt;
Environment variables are set on each system defining the base Tomcat location, but I can't seem to reference this in my application context. I've looked in this forum, Sun's, and the Tomcat site for help, but nothing quite fits. Any thoughts on the best way to point to my data?
If specifying the machines-specific paths in a property file is viable for you, you can probably use org..beans.factory.config.PropertyP laceholderConfigurer.
Thanks, I hadn't thought about that, the property file would be one way to reduce the number of changes per install (We've used that with some other apps we deploy. ops: )
Another way is to set an environment variable in the apps web.xml. I'm looking to not change anything in the war we use to distribute between my development machine, a test server, a demo machine, and the production servers. These are all Tomcat 5 installs on macs, linux, and winXP. |
|