

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.
sprig-boot의 버전이 올라가면서 순환 참조가 금지되었다.
나의 상황
// jwtUtil
public clss JwtUtil{
private final UserService userService;
...
UserDetails userDetails = userService.loadUserByUsername(username);
}
//userService
public class UserService implements UserDetailsService{
private final JwtUtil jwtUtil;
}
처음에 userService를 만들때 UserDetailService를 상속받아 사용하고 있었다.
그래서 jwtUtil에서 UserDetails를 얻기 위해 userService bean이 생성되어 있어야하는데 그러기 위해서는jwtUtil bean이 생성되어 있어야했다.
즉!! jwtUtil > userService > jwtUtil > ... 무한 반복
순환 구조를 끊어주면 된다.
userService를 userDetailsServiceImpl로 나누어 상속을 옮겨주었다.
참조
https://velog.io/@platinouss/Spring-Circular-References-%ED%95%B4%EA%B2%B0%ED%95%98%EA%B8%B0