개발 이야기
Spring boot 2.4.5 @AuthenticationPrincipal occurs null
호돌맨
2021. 4. 30. 15:07
문제
Spring boot 2.4.5로 업그레이드 한 뒤 authentication 값이 null이다.
@GetMapping("/api/users/me")
public UserResponse getMe(@AuthenticationPrincipal Authentication authentication) {
// ...
// ...
}
해결
PrincipalMethodArgumentResolver를 추가해도 되지만
그냥 @AuthenticationPrincipal
annotation을 제거하면 된다.
스프링에서 문서 수정하는걸 깜빡 했나보다.