Programing/Spring Boot

오류) Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

딩코딩 2023. 8. 28. 13:56

스프링 부트 프로젝트를 실행하는데 다음과 같은 에러가 나타났다.

 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1

 

 

오류내용을 읽어보니 Spring Boot 애플리케이션이 데이터베이스 관련 설정을 찾지 못해서 발생하는 것으로 보인다.

나의 경우는 새로 만든 프로젝트에서 DB에대한 설정을 아무것도 해주지 않았다.

 

따라서  build.gradle 파일에서 아래와 같이 db에 대한 의존성을 추가해주었더니 해결되었다.

dependencies {
	implementation 'com.h2database:h2' // H2 Database
}