问题描述:

springboot启动时遇到错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-09 16:10:19.148 ERROR 3668 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

    Property: driver-class-name
    Value: com.mysql.cj.jdbc.Driver
    Origin: "driverClassName" from property source "source"
    Reason: java.lang.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader

Action:

Update your application's configuration

原因分析:

springBoot作测试的时候默认的是h2数据库 而我用的是mysql所以需要在 application.properties中指定一下

解决方案:

在 application.properties中指定一下

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐