报错信息
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2023-06-17T00:38:41.863+08:00 ERROR 13520 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** 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).
- 使用的依赖
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.2.8</version> </dependency>
- 数据源连接配置
spring: datasource: druid: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/reggie username: root password: 285013
- 如果上述数据源配置无效,可以修改为如下配置方式:
解决
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/reggie username: root password: 285013 # 指定数据源类型 type: com.alibaba.druid.pool.DruidDataSource