티스토리 뷰
Backend/Spring
SpringBoot - MySQL 연결하도록 설정하고 난 이후에 프로젝트 실행시 에러 발생한다면?
out of coding 2022. 12. 9. 22:43MySQL을 프로젝트에 연결하고 프로젝트 실행을 했는데 다음과 같은 에러가 발생하게 된다면?
저는 다음과 같은 에러를 만났습니다.
caused by: org.springframework.beans.factory.beancreationexception: error creating bean with name 'datasource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceconfiguration$hikari.class]: bean instantiation via factory method failed; nested exception is org.springframework.beans.beaninstantiationexception: failed to instantiate [com.zaxxer.hikari.hikaridatasource]: factory method 'datasource' threw exception; nested exception is java.lang.illegalstateexception: cannot load driver class: com.mysql.jdbc.driver |
원인은 dataSource 연결 문제. MySQL이나 MyBatis등 DB 관련 설정을 추가하고 나서 build gradle에 제대로 추가를 안해주어서 그렇습니다.
다음을 추가하여주어 봅니다.
그래도 안된다면 다른 dependencies를 추가하여 주어야 합니다.
dependencies {
.....
implementation("mysql:mysql-connector-java")
.....
}
'Backend > Spring' 카테고리의 다른 글
Spring. SpringBoot + Gradle + Java + JPA + lombok + h2 DB (2) (0) | 2020.08.22 |
---|---|
Spring. SpringBoot + Gradle + Java + JPA + lombok + h2 DB (1) (0) | 2020.08.22 |
IntelliJ에서 MySQL을 Spring MyBatis CRUD 하기 (3) | 2020.02.21 |
Spring. Bean 생성과 사용 (0) | 2020.01.19 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- tomcat
- Windows
- android
- centos8
- Python
- MySQL
- intellij
- ios
- go
- SWIFT
- Spring
- github
- Java
- php
- git
- nodejs
- war
- ubuntu
- windows10
- Xcode
- enum
- Gradle
- docker
- golang
- Codable
- Kotlin
- CentOS
- rxswift
- Linux
- cocoapods
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함