天天看点

在Servlet的Filter中获取Spring注入的Bean

    ServletContext sc = req.getSession().getServletContext();
    XmlWebApplicationContext cxt = (XmlWebApplicationContext) WebApplicationContextUtils.findWebApplicationContext(sc);
    AppVerService appVerServiceImpl = (AppVerService) cxt.getBean("appVerServiceImpl");