Spring boot 에서 테스트코드 @DataJpaTest 와 @DataRedisTest java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class

박상준·2024년 8월 30일
0
  • DataJpaTest 와 DataRedisTest 에는
    @BootstrapWith(DataJpaTestContextBootstrapper.class)
    @BootstrapWith(DataRedisTestContextBootstrapper.class)
    • 내장된 테스트 어노테이션의 @Bootstrap 어노테이션이 중복되어서 같이 사용할 순 없다..
  • 그냥 별도로 클래스를 분리시켜서 테스트해야함.
  • 아니면 @SpringBootTest 를 사용해야하는데
    • 난 빈을 전부 로드시키고 싶진 않기에.. 그냥 각각 위치에서 redis를 사용하는 부분은 모킹처리했다.
    • 이런식으로 작업해야
    • db 어느 부분에서 오류가 있었는지 확인하기가 더 쉬울 것 같았다.
profile
이전 블로그 : https://oth3410.tistory.com/

0개의 댓글