admin 管理员组

文章数量: 1103785

使用SpringSecurityOauth2启动异常:

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘openIdAuthenticationSecurityConfig’: Unsatisfied dependency expressed through field ‘ygerAuthenticationSuccessHandler’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘ygerAuthenticationSuccessHandler’: Unsatisfied dependency expressed through field ‘authorizationServerTokenServices’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration’: Unsatisfied dependency expressed through field ‘configurers’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘ygerAuthorizationServerConfig’: Unsatisfied dependency expressed through field ‘authenticationManager’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.authentication.AuthenticationManager’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2020-12-03 14:54:16.351 INFO 4512 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

解决办法:
核心上面已经标记出来,添加一个配置类就好了:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author liurui
 * @date 2019年11月25日
 */
@Configuration
public class ConfigurationUpdateBean extends WebSecurityConfigurerAdapter {

    @Bean
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }
}

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/www.520sys.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/www.520sys.cn/tmp/route_read.php, Line: 207, include(/www/wwwroot/www.520sys.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/www.520sys.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/www.520sys.cn/tmp/route_read.php)
File: /www/wwwroot/www.520sys.cn/index.php, Line: 29, include(/www/wwwroot/www.520sys.cn/tmp/index.inc.php)