Web & Mobile/SpringBoot

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

byunghyun23 2022. 1. 21. 14:47

SpringBoot 프로젝트 생성 후 MyBatis 사용하고자 할 때 발생할 수 있는 오류입니다.

Error Log

해당 오류는 pom.xml에 mybatis dependency를 작성하고 application.properties에 datasource로 데이터베이스 정보를

입력하지 않았기때문에 발생합니다.

pom.xml
application.properties (datasource 주석 처리 상태)

 

해결 방법은 데이터베이스를 사용하지 않는다면 pom.xml에 mybatis dependency를 제거하거나, mybatis를 이용하여 데이터베이스를 사용한다면 application.properties에 데이터베이스 정보를 입력해주면 됩니다.

(위 그림 3~10 라인 주석 해제)