方法1:
在dodoFilter中添加以下代码
HttpServletRequest req = (HttpServletRequest)request;
ServletContext sc = req.getSession().getServletContext();
XmlWebApplicationContext cxt = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(sc);
if(cxt != null && cxt.getBean("entryReportZYService") != null && entryReportZYService == null)
entryReportZYService = (EntryReportZYService) cxt.getBean("entryReportZYService");
方法2:
在init方法中添加
ServletContext servletContext = filterConfig.getServletContext();
XmlWebApplicationContext cxt = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(sc);
if(cxt != null && cxt.getBean("entryReportZYService") != null && entryReportZYService == null)
entryReportZYService = (EntryReportZYService) cxt.getBean("entryReportZYService");
方法3:
在init方法中添加
ServletContext servletContext = arg0.getServletContext();
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext.getAutowireCapableBeanFactory();
autowireCapableBeanFactory.configureBean(this, "entryReportZYService");
若有涉及版权问题,请及时发送私信告知。