티스토리 뷰

728x90

Problem

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

Cause

스프링 부트 auto-configuration이 클래스 패스에 추가된 디펜던시를 기반으로 빈을 자동으로 구성을 시도한다.

JPA 디펜던시 클래스 패스를 갖고있기 때문에, 스프링 부트는 자동으로 JPA 데이터 구조를 구성하려하지만 스프링 부트에게 auto-congifuration을 수행할 정보를 제공하지 않았기 때문임.

예를들면 MySQL과 같은 외부 데이터 베이스로 작업을 해야할 경우, JDBC 커넥터가 필요한데 이 연결 속성을 정의해주지 않았기 때문이다.

Solution

  1. application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/myDb
spring.datasource.username=user1
spring.datasource.password=pass
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

application.properties 내에 DB 연동 속성을 입력해주면 해결된다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함