Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

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

 

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

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

 

解决办法:

 

 

 

在启动类注解上

  @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

然后启动成功!

如果还不成功,
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ComponentScan(basePackages = {"com.example.testtwo.dao"})

 


 

 
 

 

posted @ 2021-06-08 16:22  Marie_yl  阅读(2367)  评论(0编辑  收藏  举报