}
// shutdown spring
Object attr = ctx.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
if (attr != null) {
// get web application context from the servlet context
ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) attr;
ConfigurableBeanFactory factory = applicationContext.getBeanFactory();
// for (String scope : factory.getRegisteredScopeNames()) {
// logger.debug("Registered scope: " + scope);
// }
try {
for (String singleton : factory.getSingletonNames()) {
logger.debug("Registered singleton: {}", singleton);
factory.destroyScopedBean(singleton);
}
} catch (RuntimeException e) {
}
factory.destroySingletons();
applicationContext.close();
}
} catch (Throwable e) {
logger.warn("Exception {}", e);
} finally {
super.contextDestroyed(sce);