You can put your properties in a file and specify the name and location of the file URL of the resource URL in web.xml. The resource value is set in geronimo-web.xml.
Your web.xml will have the following entry:
<resource-ref> <res-ref-name>configFileName</res-ref-name> <res-type>java.net.URL</res-type> </resource-ref>
In geronimo-web.xml you define a value for configFileName
<name:resource-ref> <name:ref-name>configFileName</name:ref-name> <name:url>file:
In java, you have the following code to search for a value:
initialContext = new InitialContext(); URL url = (URL) initialContext.lookup("java:comp/env/configFileName"); String configFileName = url.getPath();
Then you need to open the file and read any value.
The result of all this is that you have properties in the file on the file system. It will not be overwritten if you redeploy your application.
source share