Shiro_DelegatingFilterProxy
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的更多相关文章
- 配置ShiroFilter需要注意的问题(Shiro_DelegatingFilterProxy)
ShiroFilter的工作原理 ShiroFilter:DelegatingFilterProxy作用是自动到Spring 容器查找名字为shiroFilter(filter-name)的bean并 ...
随机推荐
- Python基础 — NumPy
NumPy--简介 Numpy(Numerical Python的简称)是一个由多维数组对象和用于处理数组的例程集合组成的库. Numpy内部解除了Python的PIL(全局解释器锁),运算效率极 ...
- [Swift]二分法的两种方式
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- loadrunner中get和post请求
loadrunner中可以使用web_url和web_link发送get请求,使web_submit_form和web_sumbit_data发送post请求. 有什么不同呢?推荐使用哪一个? web ...
- [SDOI2010]外星千足虫(高斯消元)
高斯消元裸题... 方法一:暴力,O(2^n)20分 方法二:直接Gauss,加点玄学技巧搞得好的话70分 方法三:使用bitset优化,复杂度:$O(\frac{n^3}{ω})$ 不会的同学看一下 ...
- Joseph UVA 1452 Jump
题目传送门 /* 数学:约瑟夫环问题的变形,首先定义f[i]表示剩下i个人时,最后一个选出的人,有个公式:f[i] = (f[i-1] + m) % i f[1] = 0(编号从0开始),那么类似最后 ...
- MyEclipse无法自动编译项目故障一例
MyEclipse导入项目后发现无法自动编译,classes目录下没有编译的类. 尝试的解决方法: 1.刷新项目,失败: 2.project->clean-,失败: 3.关闭项目再次打开,失败: ...
- win10下spark+Python开发环境配置
Step0:安装好Java ,jdk Step1:下载好: Step2: 将解压后的hadoop和spark设置好环境变量: 在系统path变量里面+: Step3: 使用pip安装 py4j : p ...
- C语言学习(2)-GTK布局
首先了解下gtk中函数的定义格式: 记住下面几个格式看,下面的代码 声明变量:GtkAbc*abc=gtk_abc_new()声明控件; 赋值:gtk_abc_set_label(controlNam ...
- 配置Tomcat && Http简介
WEB环境搭建 1. Web服务器 Web服务器主要用来接收客户端发送的请求和响应客户端请求. 作为JavaWeb程序来说,还需要有Servet容器,容器的主要作用就是调用java程序处理用户发送的请 ...
- Farseer.net轻量级开源框架 中级篇:数据库切换
导航 目 录:Farseer.net轻量级开源框架 目录 上一篇:Farseer.net轻量级开源框架 中级篇: 动态数据库访问 下一篇:Farseer.net轻量级开源框架 中级篇: SQL执行 ...