创建名为“springsecurityfilterchain”的bean时出错Map不完整请尝试使用requesturls()完成它< something>.hasrole('user'))

mccptt67  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(483)

我有一个问题,我想标记我所有的身份验证。在扩展WebSecurityConfigureAdapter的类中,我重写了以这种方式配置的方法

@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')

有人能帮我吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题