Java:怎么使一个类只在启动tomcat的时候启动一次

日期:2017-10-07 18:22:56 人气:2

Java:怎么使一个类只在启动tomcat的时候启动一次

ServletContextListener 实现该接口即可 在应用启动时以下方法会被调用: void contextInitialized(ServletContextEvent sce); 在应用注销时以下方法会被调用: void contextDestoryd(ServletContextEvent sce); 在Web.xml中加入 完整类名(如com.myweb.listener.InitListener)
    A+
热门评论