spring security,web.ignoring()没有效果

时间:2017-04-29 11:38:29

标签: spring spring-boot spring-security spring-java-config

我只想过滤静态资源:/ ** / * .js。 所以,我添加了以下配置

web.ignoring().mvcMatchers("/**/*.js")

但仍然调用了AntPathRequestMatcher。

像这样的日志:

[org.springframework.security.web.FilterChainProxy] - /static/jquery.1.12.4.min.js has an empty filter list
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Checking match of request : '/static/jquery.1.12.4.min.js'; against '/login'
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Checking match of request : '/static/jquery.1.12.4.min.js'; against '/test/select.action'
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Checking match of request : '/static/jquery.1.12.4.min.js'; against '/test/del.action'
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Checking match of request : '/static/jquery.1.12.4.min.js'; against '/test/add.action'
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Checking match of request : '/static/jquery.1.12.4.min.js'; against '/loginPage'
[org.springframework.security.web.util.matcher.AntPathRequestMatcher] - Request '/static/jquery.1.12.4.min.js' matched by universal pattern '/**'

所以URL会被阻止,请帮帮我!

感谢~~

1 个答案:

答案 0 :(得分:0)

尝试将mvcMatchers移动到antMatchers行上方。