我们如何在Web应用程序中注册关闭挂钩?
有没有什么可以在web.xml或applicationContext.xml中注册它?
我知道如果我们使用主类的应用程序,那很简单.
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml");
context.registerShutdownHook();
Run Code Online (Sandbox Code Playgroud)
但是Web应用程序怎么样?因为它使用ContextListener