Step-by-Step

[Spring] 초기 실행 - Failed to configure a DataSource 본문

프로젝트/시행착오

[Spring] 초기 실행 - Failed to configure a DataSource

희주(KHJ) 2023. 2. 16. 21:28

초기 실행시 발생하는 에러 - 데이터베이스 연결하기 위한 정보가 없음

 

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

Database 연결하기 위한 DataSource가 없어서 그렇다 

 

 

해결

내가 쓴 예전 글을 참조해서 작성함 : https://smile-development.tistory.com/55

# MySQL 설정 
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# DB Source URL 
spring.datasource.url=jdbc:mysql://localhost:3306/[DB이름]

# DB username 
spring.datasource.username=[DB 사용자이름]

# DB password 
spring.datasource.password=[DB 비밀번호]

이걸  Application.properties에 추가해주면 끝!

 

 

Comments