I'm a newbie, so please bear with me. I have a myApp.properties file that is in the ${catalina.home}/conf directory.
In my applicationContext.xml:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="location" value="file:${catalina.home}/conf/myApp.properties"/>
</bean>
This appears to build and deploy fine. However, when I try to run a JUnit test, it cannot find the file.
JUnit test in setup:
ApplicationContext ac = new FileSystemXmlApplicationContext("web/WEB-INF/applicationContext.xml");
However, if I change the location to a hard-coded path it works:
value="file:c:\netbeans...\conf\myApp.properties". I really don't want to hard-code the location because we would have to change the applicationContext.xml when we install in a production environment. I really want the path to be relative to where Tomcat is running. When we install, we will just move the myApp.properties to the appropriate place.
I also tried setting a System Environment property: CATALINA_HOME=c:\...
Then in the style of ant, value="file:${env.CATALINA_HOME}\conf\myApp.proper ties". That obviously did not work.
Is there a simple solution to this? The entries in the forums seem way more complicated than what I'm trying to do.
Thanks.


Reply With Quote
roperties_${footprint}.properties. This lets me have a development lab version of everything, a test lab version, and a product version without rewriting any bean configurations or having to hand-edit things at deployment. I just have to have that system property variable set in each target environment to tip my code off on which properties to utilize.

