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

프로젝트 생성 후 Application을 실행하였을 때 발생하는 오류로  데이터베이스에 연결 시 필요한 정보가 없기 때문에 발생하는 문제로

프로젝트 초기에 발생한다

 

Failed to configure a DataSource 에러가 발생하는 이유는 Database에 연결할 때 필요한 정보가 없기 때문이다. 주로 스프링 프레임워크를 이용해 프로젝트를 구성하는 초기에 발생하는 문제

 

해결방법

application.properties에서 설정을 해줘야 한다

MySQL에서 diver class name, username, password, url을 확인 후 설정

 

diver class name은 mariadb 사용

username은 root

password는 본인이 지정한 비밀번호

url은 MySQL에서 생성한 스키마

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=사용자 비밀번호
spring.datasource.url=jdbc:mariadb://localhost:3306/Board

 

 

설정 후 Application을 실행 후 localhost:8080을 실행하면 해당 이미지처럼 잘 실행되는 것을 알 수 있다

(아직 아무것도 안해줬기 때문에 Whitelabel Error Page가 나오는게 정상)

반응형

+ Recent posts