[Spring Boot] ERROR: Failed to configure a DataSource
Spring BootError 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'
}