• SpringBoot2.x集成springSecurity和OAuth2.0启动错误处理


    当启用@EnableAuthorizationServer注解时,启动项目报错

    报错信息

    Description:
    
    
    Field configurers in org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration required a bean of type 'java.util.List' that could not be found.
    
    
    The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Value(value=#{@autowiredWebSecurityConfigurersIgnoreParents.getWebSecurityConfigurers()})
    
    Action:
    
    Consider defining a bean of type 'java.util.List' in your configuration.
    
    
    Process finished with exit code 1

    因为SpringBoot2.x已经将 security.oauth2的自动配置类spring-boot-autoconfigure的jar中移除。

    如OauthAuthorizationServerConfiguration.java配置类在spring-boot-autoconfigure-1.3.5.RELEASE.jar中还是存在的
    解决方法
    添加maven依赖
    <dependency>
        <groupId>org.springframework.security.oauth.boot</groupId>
        <artifactId>spring-security-oauth2-autoconfigure</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>

    SpringBoot2.x集成springSecurity,OAuth2.0的完整maven依赖

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
        <version>2.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>2.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security.oauth.boot</groupId>
        <artifactId>spring-security-oauth2-autoconfigure</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    作者:海绵般汲取
    出处:https://www.cnblogs.com/gne-hwz/
    版权:本文版权归作者和博客园共有
    转载:欢迎转载,但未经作者同意,必须保留此段声明;必须在文章中给出原文连接;否则必究法律责任
  • 相关阅读:
    学英语舌尖效应(转)
    winform程序防止重复运行
    label字符自动换行(转自网络)
    C# WINFORM中的combobox.items.add实现像web开发那样,添加显示内容text和实际value值
    三极管开关电路设计(转)
    ASPNET+ArcGIS+Flex初次使用笔记
    转:oracle日期函数集锦
    网站开发人员应该知道的62件事
    cassandra的安装与使用
    datejs一个很好用的时间日期JavaScript组件
  • 原文地址:https://www.cnblogs.com/gne-hwz/p/14820998.html
Copyright © 2020-2023  润新知