[英]Spring Boot - Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration'
[英]Error creating bean with name 'dataSource' [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]
當我嘗試在 Eclipse 中使用 Gradle 項目調試 Spring Boot 時出現以下錯誤
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor 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.IllegalStateException: Cannot load driver class: com.mysql.jdbc.Driver
我搜索了很多,大多數解決方案都來自 application.properties 文件中的錯誤,但我無法弄清楚我的問題出在哪里
server.port=8080
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/dices?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root
有什么建議嗎?
謝謝
您可以嘗試將compile("mysql:mysql-connector-java") 添加到 build.gradle 並再次檢查嗎?
問題出在 eclipse 上,它沒有下載依賴項。 Gradle 配置文件沒問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.