I know that there is a configuration file called web.xml
What I want to achieve is have another configuration file that has application specific configuration and it has to be read when the web server is started. I also want a Class to be able to read this configuration. Is there a way I can configure this is web.xml file itself or is there another way
I know that there is a configuration file called web.xml What I want to
Share
You can use the Apache Commons Configuration. Have a look at the user guide. Since you want it to be done on startup here is a sample ServletContextListener:
Now get your configuration anywhere in your web application like this:
I would create a class to hold the configuration though rather than adding it as an attribute to the ServletContext. The class would simply provide access to the configuration through a static method.