개발/이슈
![[Junit] java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test 에러](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbJwyKa%2FbtqUo9wVy9Q%2FAAAAAAAAAAAAAAAAAAAAAOfQqwPdK8PYq7Naknn_9xLyR44yLuOMcWTCa6h6qQ0J%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DGLay9rRiwsAtWTNhb51u%252BKZx5aA%253D)
[Junit] java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test 에러
junit5에서 단위테스트 초기 세팅 과정에서 다음과 같은 에러메시지를 뱉었다. java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test @SpringBootApplication 어노테이션이 붙은 클래스가 위치한 패키지의 하위 패키지에 테스트를 둬야 한다는 원칙을 어긴 것이다. 나의 경우에는 멀티모듈 프로젝트였고 테스트코드를 작성하는 모듈은 @SpringBootApplication 어노테이션이 붙은 클래스가 존재하지 않는 단순참조용 모듈이었다. 다음과 같은 구조였다. 문제해결:..