spring - 没有为根 URL 运行 Spring 过滤器
问题描述
在 Spring 配置中,我有:
<beans:bean id="myFilter" class="foo.bar.MyFilter" />
<http>
<custom-filter ref="myFilter" after="CHANNEL_FILTER"/>
我注意到,当使用此 URL 调用根页面时: https://server/myApp 则过滤器不运行,而使用 https://server/myApp/ (唯一的区别是最后的斜杠)运行过滤器. (它也适用于所有子页面,例如 myApp/this 、 myApp/th/at)
启用调试登录org.springframework.security.web.access.intercept.DefaultFilterInvocationSecurityMetadataSource
我注意到该extractMatchingAttributes()
方法甚至没有记录任何内容。
在这两种情况下都会显示正确的网页(运行正确的控制器等)。
这是为什么?
春季版本是 3.0.x
编辑:
该日志给出了提示:
DEBUG o.s.security.web.FilterChainProxy - Candidate is: ''; pattern is /**; matched=false
解决方案
推荐阅读
- excel - 如何将具有多个电子表格的 excel 拆分为具有设定行数的相同数量的电子表格?
- java.util.scanner - 扫描仪打印两次
- java - ModelMapper::map() 的非预期行为
- python - 无法在 div 中切换到 iframe
- r - 多变量曲线图
- python - 如何合并或删除列表中与前一项重复的元素?
- javascript - JS Regex - 匹配直到行尾或一个字符
- rust - 为什么`min_by`和`max_by`返回`Option
` 在 Rust 中? - xcode - 如何启用对我的 iPhone 应用程序容器的访问以进行调试
- python - 按月汇总的 Python 时间序列条件计算