Failed to configure a DataSource: no embedded datasource could be configured

Failed to configure a DataSource: no embedded datasource could be configured

1.原因
1)你的项目有读取数据库的操作。而新建的项目还没有配置datasource或者说你配置的datasource错误了。
2.解决办法
1).如果你只是想简单的测试一下,controller-service-mapper-mysql是否搭建成功(而此时你的数据库中还没有数据),只需要
添加(exclude = DataSourceAutoConfiguration.class)
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
2)如果你的数据库中有数据,则说明,你的application.yaml中datasource配置出错了。找到你的application.yaml进行检查
 datasource:
    #driver-class-name: com.mysql.jdbc.Driver,可以不写
    url: jdbc:mysql:///数据库名字
    username: root
    password: 具体密码

你可能感兴趣的:(mysql)