My app is a Web application, employs Spring, Apache CXF, ... and is deployed on Tomcat-7.
In META-INF\context.xml I specify an additional class-path element
At initialization time, it loads up a property file, (using PropertyPlaceholderConfigurer)
from within the jar/ war as well as from the file system (if found in the additional class-path)
For this I have used the following
The logs specifically say;
Loading properties file from URL [jar:file:/D:/WMSandbox/tools/apache-tomcat-7.0.40/wtpwebapps/Myserver-web/WEB-INF/lib/Myserver-1.0.0-SNAPSHOT.jar!/myConfig.properties] Loading properties file from URL [file:/D:/opt/xyz/config/myConfig.properties]
But the path(s) are (is) only getting printed in the log.
At run time, I need the exact file:/ path in a variable - how can I get that?
gave me only the exact paths of the jar's used by my application but not the file:/ path of the property file (loaded from the file system/ outside the .jar)
Any clues, how I can get the full path of the property file (loaded from the file system)
Configure a bean as below
<bean id="test" class="TestClass">
<property name="propertyLoader" ref="cnsproperties" />
With the above you will the propertyplaceholderconfigurer object and play with it using the getter methods or inbuilt methods contianed by this class. Hope you should be able to get the desired output. Let me know the results.
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss