@Description:Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
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错误解决方法
在springboot启动服务时报错 提示 url attribute有问题
第一次: 在更换局域网后 忘记修改mysql datasource的url
之前:
spring:
application:
name: xxx-service
datasource:
username: root
password: root
url: jdbc:mysql://192.168.0.101:3306/xxx
修改为:
url: jdbc:mysql://127.0.0.1:3306/xxx
第二次
该服务依赖的 其他包中 依赖了需要提供 url 属性的包 需要将其排除 如:
```
<dependency>
<groupId>xxx</groupId>
<artifactId>xxxxxxxx</artifactId>
<version>1.0.0-SNAPSHOT</version>
<exclusions>
<!--JDBC-->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</exclusion>
<!--mysql-->
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>
```