본문 바로가기
Study/Spring

[spring/Error] failed to configure a datasource: 'url' 에러

by JYHAN 2021. 1. 19.

springboot 프로젝트를 실행하다가

failed to configure a datasource: 'url'

에러를 만나 곤혹을 치렀다.

 

 

여러 방면으로 알아본 결과 원인으로는 두 가지가 있었다.

 

먼저, resources/application.properties 에 datasource를 정의하지 않았다

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:8080/db
spring.datasource.username=
spring.datasource.password=

 

하지만 나의 경우에는 다 추가를 했음에도 불구하고 에러가 발생했고, 두 번째에서 원인을 찾을 수 있었다.

 

인텔리제이에서 git pull로 프로젝트를 import할 경우 maven이 잡히지 않는달까? (추후 업데이트)

 

기존 프로젝트를 지우고 git clone으로 새로 import를 했더니 해결할 수 있었다.

 

따라서 인텔리제이에서 초기에 프로젝트를 import 할 때는 git clone을 쓰도록 하자

댓글