JMXAgent.shutdown();
// shutdown spring
// get web application context from the servlet context
ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) servletContext
.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
ConfigurableBeanFactory factory = applicationContext
.getBeanFactory();
if (factory.containsSingleton("default.context")) {
for (String scope : factory.getRegisteredScopeNames()) {
logger.debug("Registered scope: " + scope);
}
for (String singleton : factory.getSingletonNames()) {
logger.debug("Registered singleton: " + singleton);
// factory.destroyScopedBean(singleton);
}
factory.destroySingletons();
}
servletContext
.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
applicationContext.close();
// http://jakarta.apache.org/commons/logging/guide.html#Classloader_and_Memory_Management