diff --git a/tomcat-servlet/tomcat-servlet/src/main/java/com/cpic/xim/AppListener.java b/tomcat-servlet/tomcat-servlet/src/main/java/com/cpic/xim/AppListener.java new file mode 100644 index 0000000..257be8d --- /dev/null +++ b/tomcat-servlet/tomcat-servlet/src/main/java/com/cpic/xim/AppListener.java @@ -0,0 +1,33 @@ +/* + * @Author: Kane + * @Date: 2022-08-25 15:03:05 + * @LastEditors: Kane + * @LastEditTime: 2022-08-25 15:14:33 + * @FilePath: \tomcat-servlet\src\main\java\com\cpic\xim\AppListener.java + * @Description: + * + * Copyright (c) ${2022} by Kane, All Rights Reserved. + */ +package com.cpic.xim; + +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.annotation.WebListener; + +public class AppListener implements ServletContextListener +{ + @Override + public void contextInitialized( ServletContextEvent event ) + { + ServletContext context = event.getServletContext(); + + context.setAttribute( "test", "test" ); + } + + @Override + public void contextDestroyed( ServletContextEvent event ) + { + + } +}