[Spring Boot] ERROR: Failed to configure a DataSource

by 민갤

Back End /

Error Message

***************************
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).

원인

프로젝트에 DB 정보를 정의하지 않음

조치 1. RDBMS Database

application.properties에 JDBC connection properties 추가

# Data Source
spring.datasource.url=jdbc:[database]://[ip]:[port]/[databse_schema]
spring.datasource.username=[db_user_name]
spring.datasource.password=[db_user_pw]
spring.datasource.driver-class-name=[JDBC Driver]

조치 2. In Memory Database

build.gradle 에 종속성 추가 (H2)

dependencies {
    runtimeOnly 'com.h2database:h2'
}

Author

민갤

민갤

Back-End Developer

꾸잉꾸잉하고 웁니다.

로그인

디코에 오신 것을 환영해요!
전문가들의 수많은 아티클 창고 🤓