Spring/Issue

[오류 처리] Failed to load ApplicationContext

블로그 주인장 2023. 11. 9.

Failed to load ApplicationContext

SpringBoot 프로젝트에서 TDD 구현 시에 발생하는 에러 관련 내용을 알아보겠습니다.


오류 내용

  • java.lang.IllegalStateException: Failed to load ApplicationContext

 

오류 원인

  • 데이터베이스 소스를 구성하지 못해서 나오는 에러이다.
  • Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

 

오류 해결 방안

  • H2, HSQL or Derby 등의 데이터베이스를 추가해줘야한다.
  • 해당 프로젝트에서는 H2 DataBase 의존성을 추가하여 진행하였다.
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
</dependency>

 

오류 해결 후 테스트 진행

 

반응형

댓글