监听器注入实例失败 注入失败 无法注入
private static RunCabinetProductService runCabinetProductService; private static RocketmqLogMapper rocketmqLogMapper;
实现接口
@Configuration public class RocketMQConsumer implements ServletContextListener {
实现初始化方法
@Override public void contextInitialized(ServletContextEvent servletContextEvent) { rocketmqLogMapper = WebApplicationContextUtils .getWebApplicationContext(servletContextEvent.getServletContext()) .getBean(RocketmqLogMapper.class); runCabinetProductService = WebApplicationContextUtils .getWebApplicationContext(servletContextEvent.getServletContext()) .getBean(RunCabinetProductService.class); } @Override public void contextDestroyed(ServletContextEvent servletContextEvent) { }