inblog logo
|
👨🏻‍💻DriedPollack's Blog
    ❗Error🌼Spring

    [Spring boot] AnnotationConfigContextLoaderUtils 에러 해결 방법

    테스트 코드 실행 시 발생하는 'AnnotationConfigContextLoaderUtils' 오류는 'application-test.properties' 파일에 문제가 있거나 해당 파일이 적절히 로드되지 않을 때 발생한다. 이 문제는 resources 폴더 아래에 'application-test.properties' 파일을 생성함으로써 해결할 수 있다.
    DriedPollack's avatar
    DriedPollack
    May 10, 2024
    [Spring boot] AnnotationConfigContextLoaderUtils 에러 해결 방법
    Contents
    📝개요🔎원인✅해결 방법

    📝개요

    • 테스트 코드를 작성해서 실행하려고 하니 다음과 같은 오류가 발생했다.
    AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class

    🔎원인

    • application-test.properties 파일에 문제가 있거나 해당 파일이 적절히 로드되지 않을 때 발생할 수 있다.
      • 나의 경우 resources 폴더 아래에 application-test.properties 파일이 존재하지 않는 상태에서 테스트 파일의 코드에서 @TestPropertySource(locations = "classpath:application-test.properties") 어노테이션을 사용하려고 했기 때문에 해당 에러가 발생했다.

    ✅해결 방법

    • 이를 해결하기 위해 resources 폴더 아래에 application-test.properties 파일을 생성했다.
    Share article
    Contents
    📝개요🔎원인✅해결 방법

    👨🏻‍💻DriedPollack's Blog

    RSS·Powered by Inblog