修改源码,解决security标签库找不到ioc容器问题

此问题与之前security扫描不到bean是同样的问题

重写类

注释掉207行

ApplicationContext appContext = SecurityWebApplicationContextUtils.findRequiredWebApplicationContext(getServletContext());
此方法依然只能找到spring Ioc容器
添加自己的代码
// 获取servletContext对象
ServletContext sc = this.getServletContext();
// 拼接SpringMVC将IOC容器存入servletContext域的时候使用的属性名
String servletName = "dispatcherServlet";
String attrName = FrameworkServlet.SERVLET_CONTEXT_PREFIX+servletName;
ApplicationContext appContext = (ApplicationContext)sc.getAttribute(attrName);

//修改源码停不下来,挖一个坑,有无数个坑等着你去填^-^
原文地址:https://www.cnblogs.com/myPrBB/p/12606658.html