I have written a small test to see how init and destroy methods are working in Spring Web Application.
Here is a small bean I created:
When the WebApplicationContext is being initialized, everything's just fine, I can see log saying "init() called".Code:public class InitDestroyTester { Logger logger = Logger.getLogger(InitDestroyTester.class); public void init() { logger.info("init() called"); } public void destroy() { logger.info("destroy() called"); } } <bean id="initDestroyTester" class="...InitDestroyTester" init-method="init" destroy-method="destroy" />
However when webapp is removed from context (i.e. when I redeploy my webapp in Tomcat), I can't see "destroy() called" message in log.
I figured out that it is only because Log4J was shutdown BEFORE InitDestroyTester could log something upon "destroy" call.
How can I configure Log4J to be shutdown only after WebApplicationContext was disposed?
Thanks in advance.


Reply With Quote
