Search

Circular dependency 에러의 원인

SecurityConfig객체와 내부에서 선언된 principalOAuth2UserService객체
이 두가지 객체가 BCryptPasswordEncoder 객체를 동시에 참조하고 있었기 때문에 에러가 난것 같다.
BCryptConfig 라는 외부 Configuration 클래스를 만들어 SecurityConfig , principalOAuth2UserService 객체가 BCryptPasswordEncoder 객체를 외부에서 받을 수 있도록 하였다.
앞으로 Bean 객체를 등록할 때엔 custom configuration 클래스를 만들어 관리하는게 좋을 것 같다.