此问题与之前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);

//修改源码停不下来,挖一个坑,有无数个坑等着你去填^-^
posted on 2020-03-31 17:28  ha1998  阅读(196)  评论(0编辑  收藏  举报