报错:Failed to configure a DataSource: url attribute is not specified and no embedd

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedd

错误:

报错:Failed to configure a DataSource: url attribute is not specified and no embedd

在网上由好几种解决方法,例如:
配置属性:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
但是治标不治本

解决方法:

项目报错后,首先我们要先到项目的tarrget目录下,查看配置文件是否正常编译生成

如果没有正常生成,直接到pom文件下查看打包方式
此处问题就是pom文件中打包方式设为了pom
报错:Failed to configure a DataSource: url attribute is not specified and no embedd
直接删除该行,默认打包为jar
再删除target目录下文件
重新编译
发现没有出错