2023. 12. 12. 19:56ㆍSpringboot
1. 문제 상황
The dependencies of some of the beans in the application context form a cycle:
┌──->──┐
| your filename defined in file [yourfilenamePath/yourfile.class]
└──<-──┘
해당 상황은 순환 참조가 발생한 오류 상황이며,
순환참조 문제란 A 클래스가 B 클래스의 Bean 을 주입받고, B 클래스가 A 클래스의 Bean 을
주입받는 상황처럼 서로 순환되어 참조할 경우 발생하는 문제를 의미한다.
필자의 상황은 WebSecurityConfig.java와 JwtProvider.java 서로 의존성주입을 하고 있는 상황이기에
순환 참조하고 있기에 안됩니다.

2. 문제 해결
WebSecurityConfig
@Bean >> JwtProvider
@Bean >> MemberDetailsSerivceImpl
@Bean >> AuthenticationManager를 생성자 주입
JwtAuthenticationFilter.java
@Bean >> AuthenticationManager를 생성자 주입
** AuthenticationManager때문에 순환 참조 오류 발생
** 해결하기 위해 한개만 빈 설정

'Springboot' 카테고리의 다른 글
Spring boot를 이용한 게시글에 AWS S3 이미지 업로드 (0) | 2023.12.14 |
---|---|
Spring boot 간단한 AWS S3 MultipartFile 업로드 (0) | 2023.12.13 |
Spring boot OAuth 로그인(0) (0) | 2023.12.11 |
Spring boot OAuth 로그인(1) (1) | 2023.12.07 |
Spring boot 환경 변수 설정 (1) | 2023.12.05 |