admin管理员组

文章数量:1205733

I am migrating from spring mvc to spring boot 2.7.1 with oauth 2.0. After doing all the necessary changes I get a circular reference issue when the application is getting started.

error details:

***************************

APPLICATION FAILED TO START

***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

OAuth2AuthorizationServerConfig (field private org.springframework.security.authentication.AuthenticationManager com.OAuth2AuthorizationServerConfig.authenticationManager)
┌─────┐
|  webSecurityConfig
↑     ↓
|  org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration
↑     ↓
|  org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration
↑     ↓
|  authorizedClientRepository defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfiguration.class]
└─────┘

Action:

Relying upon circular references is discouraged and they are prohibited by
default. Update your application to remove the dependency cycle between
beans. As a last resort, it may be possible to break the cycle automatically
by setting spring.main.allow-circular-references to true.`

Using @lazy annotation at AuthenticationManager
trying to exclude autoconfig in spring boot for oauth alone using exclusions

本文标签: Spring MVC to Spring Boot 271 MigrationStack Overflow