springboot创建项目后运行报错【Failed to configure a DataSource: 'url' attribute is not specified and no embedd...

 

 

先说解决办法

 配置属性:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

springboot创建项目后运行报错【Failed to configure a DataSource: 'url' attribute is not specified and no embedd...

 

 

解释原因:

springboot创建项目后运行报错【Failed to configure a DataSource: 'url' attribute is not specified and no embedd...

新创建的项目没有配置数据源  所以在项目启动的时候回去查找项目的数据源,但是发现找不到所以报错。

 

 

 

如果配置了数据源之后  就算是没有排除自动配置数据源

 

springboot创建项目后运行报错【Failed to configure a DataSource: 'url' attribute is not specified and no embedd...

项目也是可以启动成功的