【问题标题】:Failed to determine a suitable driver class spring无法确定合适的驱动程序类弹簧
【发布时间】:2021-11-22 09:25:09
【问题描述】:

当我运行我的 Spring Boot 项目时,我得到了这个错误:

说明:

未能配置数据源:未指定“url”属性并且 无法配置嵌入式数据源。

原因:无法确定合适的驱动程序类

行动:

考虑以下几点:

如果你想要一个嵌入式数据库(H2、HSQL 或 Derby),请把它放在 类路径。
如果您有要从特定配置文件加载的数据库设置 您可能需要激活它(当前没有激活的配置文件)。

我的 pom.xml 文件中有这个依赖项:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
</dependency>

当我尝试将 Spring Boot 版本更改为 2.5.5 时发生此错误。

【问题讨论】:

标签: java spring spring-boot


【解决方案1】:

我发现了问题,这个依赖被删除了,这就是这个问题发生的原因。

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-config</artifactId>
</dependency>

【讨论】:

    猜你喜欢
    • 2019-03-18
    • 2019-05-27
    • 2022-01-19
    • 2021-09-12
    • 2023-02-04
    • 2019-12-06
    • 2019-05-10
    • 2018-12-26
    • 2020-10-23
    相关资源
    最近更新 更多