SpringBoot项目启动报错Failed to determine a suitable driver class

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:51507', transport: 'socket'

Process finished with exit code 0
  • 说明: 配置数据源失败:未指定“url”属性,无法配置嵌入式数据源。

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

  • 行动: 考虑以下事项:

  • 如果您想要一个嵌入式数据库(H2、HSQL或Derby),请将其放在类路径上。

  • 如果要从特定配置文件加载数据库设置,则可能需要激活它(当前没有激活的配置文件)。

经过测试,我把pom.xml文件里的mysql、mybatis注释掉之后,就可以运行啦

<!--        <dependency>-->
<!--            <groupId>mysql</groupId>-->
<!--            <artifactId>mysql-connector-java</artifactId>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.mybatis.spring.boot</groupId>-->
<!--            <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!--            <version>2.1.3</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>com.alibaba</groupId>-->
<!--            <artifactId>druid-spring-boot-starter</artifactId>-->
<!--            <version>1.1.10</version>-->
<!--        </dependency>-->

<!--        <dependency>-->
<!--            <groupId>com.github.pagehelper</groupId>-->
<!--            <artifactId>pagehelper-spring-boot-starter</artifactId>-->
<!--            <version>1.4.1</version>-->
<!--        </dependency>-->

修改后运行状况如下:
在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐