spring java.lang.IllegalStateException:无法自检AuthenticatedPrincipalOAuth2AuthorizedClientRepository类

hrirmatl  于 2023-03-07  发布在  Spring
关注(0)|答案(1)|浏览(151)

在向我的项目添加Oauth2配置时,我收到了以下错误:

java.lang.IllegalStateException: Failed to introspect Class [org.springframework.security.oauth2.client.web.AuthenticatedPrincipalOAuth2AuthorizedClientRepository] from ClassLoader [jdk.internal.loader.ClassLoader$AppClassLoader@73d16e93]

供参考:博客链接
我的maven项目中有这些依赖项。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.0</version>
</parent>

...
    <!-- Spring Boot Web starter -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- Security Starter -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <!-- Oauth2 client -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-oauth2-client</artifactId>
    </dependency>
    <!-- WebClient -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>

请告诉我我在这里做错了什么?我认为问题与依赖关系有关。

dba5bblo

dba5bblo1#

我有类似的问题,通过将spring-security-oauth2-client降级到5.8.2解决
错误文本:
Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setAuthorizedClientRepository' parameter 0;

相关问题