1.DelegatingFilterProxy实际上是Filter的一个代理对象。默认情况下,Spring会到IOC容器中查找与<filter-name>对应的filter bean。也可以通过targetBeanName的初始化参数来配置bean的id。

2.配置shiroFilter

--id必须和web.xml文件中配置的DelegatingFilterProxy的<filter-name>一致。为什么?(看下文)
--若不一致,则会抛出异常。因为Shiro会来IOC容器寻找与<filter-name>名字对应的filter Bean

(1)查看org.springframework.web.filter.DelegatingFilterProxy的源码,

     /**
* Return the name of the ServletContext attribute which should be used to retrieve the
* {@link WebApplicationContext} from which to load the delegate {@link Filter} bean.
*/
public String getContextAttribute() {
return this.contextAttribute;
}
     /**
* Set the name of the target bean in the Spring application context.
* The target bean must implement the standard Servlet Filter interface.
* <p>By default, the {@code filter-name} as specified for the
* DelegatingFilterProxy in {@code web.xml} will be used.
*/
public void setTargetBeanName(String targetBeanName) {
this.targetBeanName = targetBeanName;
}

(2)做以下调整,

web.xml:

applicationContext.xml:

结果:可以正常运行。

Shiro_DelegatingFilterProxy的更多相关文章

  1. 配置ShiroFilter需要注意的问题(Shiro_DelegatingFilterProxy)

    ShiroFilter的工作原理 ShiroFilter:DelegatingFilterProxy作用是自动到Spring 容器查找名字为shiroFilter(filter-name)的bean并 ...

随机推荐

  1. Eclipse中直接执行sql语句(图文说明)

    转自:https://blog.csdn.net/changjyzzu/article/details/45487847 1.首先新建sql文件,然后打开文件 22.右键点击空白处,点击set-con ...

  2. C#面向过程之类型转换、算术运算符、关系运算符、逻辑运算符、if-else语句、switch-case、循环结构(while、for)、三元表达式

    数据类型转换: int.parse()只能转换string类型的 当参数为null时会报异常int i =Convert.ToInt32(false) 运行结果是0int i =Convert.ToI ...

  3. bzoj 1059: [ZJOI2007]矩阵游戏【匈牙利算法】

    注意到怎么换都行,但是如果把某个黑方块用在对角线上,它原来所在的行列的的黑方块就都不能用 所以要选出n组不重的行列组合,这里用匈牙利算法做二分图匹配即可(用了时间戳优化) #include<io ...

  4. bzoj 1628: [Usaco2007 Demo]City skyline【贪心+单调栈】

    还以为是dp呢 首先默认答案是n 对于一个影子,如果前边的影子比它高则可以归进前面的影子,高处的一段单算: 和他一样高的话就不用单算了,ans--: 否则入栈 #include<iostream ...

  5. bzoj1880: [Sdoi2009]Elaxia的路线(spfa,拓扑排序最长路)

    1880: [Sdoi2009]Elaxia的路线 Time Limit: 4 Sec  Memory Limit: 64 MBSubmit: 1944  Solved: 759[Submit][St ...

  6. [Swift通天遁地]一、超级工具-(17)自定义的CVCalendar日历

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  7. 思维题+set URAL 1718 Rejudge

    题目传送门 /* 题意:数据加10组,再删掉第6组数据,问rejudge后最少最多几个作者收到邮件 思维题:当错在6时结果是不一定,错在7时是一定改变,因为会变成6 思路没错,但用结构题排序一直WA, ...

  8. 题解报告:poj 3468 A Simple Problem with Integers(线段树区间修改+lazy懒标记or树状数组)

    Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. On ...

  9. pycharm但多行注释快捷键

    pycharm中同时注释多行代码快捷键: 代码选中的条件下,同时按住 Ctrl+/,被选中行被注释,再次按下Ctrl+/,注释被取消

  10. mysql-installer-web-community-5.7.18.1.msi的安装(图文详解)

    不多说,直接上干货! 说在前面的话 我为什么已经尝试和使用过同类型产品的很多MySQL版本,还要书写这篇博客呢?基于mysql-installer-web-community-5.7.18.1.msi ...