java - 创建名为 'springSecurityFilterChain' 的 bean 时出错。不完整的映射。尝试使用 requestUrls() 完成它。.hasRole('用户')
问题描述
我有一个问题,我想标记我的所有身份验证。在扩展 WebSecurityConfigurerAdapter 的类 t 中,我以这种方式覆盖方法配置
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.authorizeRequests()
.requestMatchers(RequestMatcherResolver.getRequestMatchers())
.authenticated()
.and()
.exceptionHandling()
.authenticationEntryPoint(resolveExceptionEntryPoint);
}
但我得到了一个远征:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: An incomplete mapping was found for []. Try completing it with something like requestUrls().<something>.hasRole('USER')
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: An incomplete mapping was found for []. Try completing it with something like requestUrls().<something>.hasRole('USER')
Caused by: java.lang.IllegalStateException: An incomplete mapping was found for []. Try completing it with something like requestUrls().<something>.hasRole('USER')
有谁能够帮我?
解决方案
推荐阅读
- typescript - 在我的应用程序中使用单例。我是否正确实施它?
- system-verilog - 带有变量的系统verilog绑定断言序列
- javascript - 有什么原因,为什么 HTML 表单中的禁用字段仍然被传输?
- xamarin.forms - Xamarin.Forms、iOS、Android 中的后台服务
- uwp - UWP 标题栏的自定义
- javascript - Vuetify 自动完成可以有两个数组吗?
- typescript - 数组解构错误地推断出创建数组的类型
- php - html2pdf 输出在 pdf 中显示希腊字符的问号
- javascript - 下载并将 c# excel 字节数组转换为 javascript blob
- javascript - 为什么容器边框会弄乱 Masonry.js 项目的放置?