1)@ServletComponentScan注解+@WebListener注解 2)@Bean注解+ServletListenerRegistrationBean类 转载于:https://www.cnblogs.com/hongchengshise/p/10497363.html