springBoot-cloud的错误
报错如下:
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).
错误产生原因:
公共工程下使用了数据库,而其他工程引入公共工程时,未添加相关依赖和数据库链接信息
解决示例:
com.baomidou
mybatis-plus-boot-starter
${mybatisplus.version}
mysql
mysql-connector-java
8.0.23
# 配置数据库相关链接
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/bill-manager
username: root
password: root