의존성에 mysql-connector-j를 빼먹으면 다음과 같은 로그가 나온다.
초기에 dependencies를 구성할 때 실수로라도 빼먹지말자!!!!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is 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.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
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.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
Caused by: java.lang.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
🐣 해결
implementation 'com.mysql:mysql-connector-j:8.0.31'
dependencies에 추가해준다.
아래 사이트에서 원하는 버전을 고르면 된다.
https://mvnrepository.com/artifact/com.mysql/mysql-connector-j/8.0.31
반응형
'Framework > Spring Boot' 카테고리의 다른 글
[Error] Failed to start bean 'documentationPluginsBootstrapper' (0) | 2023.01.21 |
---|---|
[Error] "The specified key byte array is 128 bits which is not secure enough for any JWT HMAC-SHA algorithm. (0) | 2022.12.09 |
트랜잭션 (0) | 2022.10.26 |
Spring Security (0) | 2022.10.06 |
OAuth2User (0) | 2022.10.06 |