[英]Error creating bean with name 'dataSource' [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]
i'm getting the following error when i try to debug a Spring boot with Gradle project in Eclipse当我尝试在 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
i've searched a lot, and most of the solutions came from something that is wrong in the application.properties file, but i can not figure what is wrong in mine我搜索了很多,大多数解决方案都来自 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
Any suggestion?有什么建议吗?
thanks谢谢
您可以尝试将compile("mysql:mysql-connector-java") 添加到 build.gradle 并再次检查吗?
The problem was with eclipse which was not downloading the dependencies.问题出在 eclipse 上,它没有下载依赖项。 Gradle configuration files were ok
Gradle 配置文件没问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.