I tried looking through the discussions but couldn't find any conclusive answers. Currently we are reading property files in our J2EE app, using the ClassLoader approach. I am looking for an out of the box open source solution, some framework that can be used to read and cache property files (XML or regular .properties file). Also it should be able to dynamically pick up any changes made to the property file. I am also planning to change the property file to an XML, wrap it with a Java class with getters. Is there anything open source solution out there? If not, what is the industry best practice. Should we move the properties to the database and then cache them. Again any framework that can cache and pick up updates from the database? I have checked OSCache, it does not pick up updates from the database. Any guidance from gurus will be appreciated! Thanks.
- Posted by: Mandeep Khambay
- Posted on: November 10 2006 16:20 EST
- Re: What is the best practice for reading property files in J2EE by Farzad Kohantorabi on November 12 2006 09:42 EST
- Re: What is the best practice for reading property files in J2EE by Rakesh Malpani on November 13 2006 11:47 EST
- Re: What is the best practice for reading property files in J2EE by Mandeep Khambay on November 13 2006 14:56 EST
Take a look at Apache commons-configuration. This might be what you are looking for. http://jakarta.apache.org/commons/configuration/ IMHO, properties that are fine to go to database should be application catalog data, like a list of countries. And you can get an MBean to refresh those values when changes happen. For configuration properties, I would still stick to putting properties in text files.
Is there anything open source solution out there?http://obix-framework.sourceforge.net/ Regards, Rakesh.
Thanks Farzad and Rakesh, I appreciate your thoughts and comments. I reviewed both jakarta commons configuration and obix for 2 of my main requirements, type safety and dynamic updates. I am still not sure about caching, I am assuming values are being cached. Does Spring framework provide these features? And can either of these frameworks be integrated with Spring? Jakarta Commons Configuration: - Type safety can be achived by using beans - Dynamic updates can be picked up by registering Event listeners. Obix: - Type safety - I found a tag in the XML for type string. I am not sure if other types can be specified (Integer, Long...). Would you know more on this? - Dynamic updates - this is a kewl feature of this framework, provides it out of the box.