Backend/Troubleshooting

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

땅지원 2022. 12. 27. 14:14

Spring Boot 초기 프로젝트를 Initializr를 통해서 생성 한 뒤 최초 실행 할 경우 다음과 같은 오류가 발생하면서

정상적으로 실행이 되지 않을 경우.

 

 

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

 

 

application.properties 에 다음과 같이 JDBC url을 추가해준다. [Mysql 일 경우] (Oracle이나 다른 DB는 응용하세요.)

 

# DataSource

spring.datasource.url=jdbc:mysql://localhost:3306/happyhouse?autoReconnect=true
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver