This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello all i have Global class named WebServerContextListener that implements the ServletContextListener this class load every time the webapp load via the web.xml. now this has some Global settings that needs to be set for the overall webapp but there is several modules in my web app that needs to do stuff when the application loads. but i dont want to write more classes in the web.xml i like to use somehow this Global WebServerContextListener for setting stuff from modules . if i just extend this class it will not work . is there some pattern or way to do that ?
There is nothing keeping you from instanciating all of your configuration objects from a single context listener.
Having separate listeners is nice if you want the ability to add,remvoe, and reorder all of these actions without having to re-compile anything by simply editing your deployment descriptor. If you don't need this ability, by all means do everything from one listener.