Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."

According to the beginning of many solutions online are:

Head Start class declaration @SpringBootApplication (exclude = {DataSourceAutoConfiguration.class}), but this would exclude my own database configuration,

Check did not find a lot of places where the problem lies, no matter how suspect last modified application.yml own file, not force, is not because there is no configuration file is loaded into?

With this in mind I went online search problem, there is a problem to see the role of target directory is not thought for a moment and went application.yml file is not compiled into the target directory,

First check the following unusual items inside the target directory is application.yml the configuration file,

Next is the start of the project being given, find the next target directory does not have this application.yml:

 

So finally application.yml copied to the target directory project can start normal!

Guess you like

Origin www.cnblogs.com/akiradunn/p/12344100.html
Recommended