benstpierre
benstpierre

Reputation: 33581

Elegant solution for managing .properties files in glassfish/tomcat/etc

Does anybody have a good solution for managing .properties files in a web application? Currently I have to pull apart my .war file before deploying, change the entries in my .properties file, and then redeploy to change settings.

Alternatively I can ssh into the server, change the .properties file in the deploy directory and restart the application.

A coworker has a rather elegant solution of using the GUI for setting JNDI properties in your Tomcat/Glassfish instance and reading those instead of a .properties file. The problem here is that when handing off the application to our operations teams they need to know which properties to add to JNDI.

Has anybody found a great way to deal with this issue?

Upvotes: 4

Views: 1608

Answers (2)

matt b
matt b

Reputation: 139931

One simple option is to store the properties file external to the WAR file / webapp, so that 1) they are not changed on each deployment and 2) do not need to be edited. You would simply need to adjust the logic in your webapp having to do with where the files are found.

Another option, only slightly less simple, is to use filtering during the build process so that the WAR file is build to contain properties file that are customized to the target environment. Both Ant and Maven support a very easy mechanism for using tokens and filter files to filter certain resources.

Upvotes: 5

Aravind Yarram
Aravind Yarram

Reputation: 80186

if you can store the properties in xml format(which I believe jdk supports) then there are bunch of open source libs that can generate the crud ui for that....if not the closest i found is PropertySet @ link text

Upvotes: 1

Related Questions