User와 Seller 두 개의 유형을 처리하고자 UserDetailsService 구현체를 동시에 사용했는데
Spring Security에서 인증을 처리하는 중 attemptAuthentication 메서드 내에서 재귀 호출이 발생하는 문제를 겪었다.
authentication configuration이 사용할 UserDetailsService가 2개 이상일 경우 authentication Manager를 사용하기 위해서 Bean을 호출했을때, authentication configuration 에서는 어떤 것을 가져다 쓸지 모르는 상태여서 해당하는 Bean을 반환할 때 까지 요청하는 무한 반복이 일어나 StackOverflow 가 발생한 것이다.
→ 기존의 두개의 UserDetailsService 를 하나로 합쳐서 if문을 활용하여 loadUserByUsername 오버라이드 하였다.
→ 두개의 UserDetailsService 구현체를 통합하는 CustomLoginService를 생성했다.
해당 서비스는 내부적으로 UserRepository와 SellerRepository를 사용하여
사용자 세부 정보를 로드했다.
기존의 WebSecurityConfig의 authenticationManager