gpt4 book ai didi

spring - 无法让 Oauth2 在最新版本的 Spring boot 中工作

转载 作者:行者123 更新时间:2023-12-02 08:58:44 26 4
gpt4 key购买 nike

我正在尝试使用最新的 Spring boot 版本 1.5.2.RELEASE 运行一个简单的 oauth2 应用程序。

我遵循了所有步骤spring-boot-oauth2直到他们告诉您“刚刚发生了什么”,但在配置 application.yml 后,运行应用程序不起作用并给出以下错误 -

WARN 27759 [main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.opentable.DemoApplication]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoDefaultConfiguration due to org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake) 
ERROR 27759 [main] o.s.b.f.s.DefaultListableBeanFactory: Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b07a0d6: startup date [Thu Mar 30 15:06:55 IST 2017]; root of context hierarchy

我需要显式创建配置类吗?

最佳答案

需要添加以下依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

tutorial是错的。它提到的两种获取 Spring Boot 应用程序启动的方法都生成了错误的 pom.xml。

添加上述执行器依赖项后,一切顺利。

关于spring - 无法让 Oauth2 在最新版本的 Spring boot 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43114860/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com