Today I Learned

java.lang.NullPointerException: Cannot invoke "org.example.springsecuritystudy.repository.JpaTokenRepository.findTokenByIdentifier(String)" because "this.jpaTokenRepository" is null왜인지 모르겠다..생성 시 CustomCsrfTokenRepository를 잘 연결한다. 처음에는 @Autowired 문제인 줄 알았는데 POST로 접속하게 되면 정상적으로 로그가 다 찍힌다. 그래서 뭐가 문제인지 찾아보았다.이 글 마지막에 있는 Spring Security 6 변화점을 통해 힌트를 얻었다. 공식 문서에서 해당 문구를 찾은 결과 아래와 같이 바뀐점을 찾아 볼 수 있었다...
스프링 시큐리티 인 액션 9장 공부 이후 필터에 @Component어노테이션을 걸고 Config 클래스에서 기본 인증 필터 위치에 등록했었다.@Component // 여기가 문제public class StaticKeyAuthenticationFilter implements Filter { private String authorizationKey; public StaticKeyAuthenticationFilter(@Value("${authorization.key}") String authorizationKey) { this.authorizationKey = authorizationKey; } @Override public void doFilter(ServletRequ..
java.lang.NullPointerException: Cannot invoke "com.keb.kebsmartfarm.entity.Plants.hasGrowingPlant()" because "this.plants" is null일급 컬렉션 적용하면서 plants에서 현재 키우는 식물이 있는지 확인하는 hasPlant메서드를 실행하는데 문제가 생겼다.아무래도 @Builder나 @NoArgsConstructor 중에 문제가 있는 것 같아, 빈 생성자에 new Plants()로 직접 삽입해줬다. 그런데도 문제가 있는 거 보니 @Builder 문제가 맞는 것 같다.이 글을 참고해 생성된 Builder 코드를 직접 살펴보았다.public static class ArduinoKitBuilder { ..
greatwhite
'Today I Learned' 카테고리의 글 목록