启动springboot的项目的时候报错 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

启动springboot项目报错
提示:`**Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-19 12:52:45.406 ERROR 18460 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


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

Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
**`

因为我们手动配置了数据源,导致项目去自动配置的时候出现问题
所以解决办法:在启动配置上面加上@SpringBootApplication(scanBasePackages = {"com.xhl"},exclude = {DataSourceAutoConfiguration.class})
这样就排除自动配置,启动的时候找我们手动配置的数据库连接

posted on 2020-12-19 13:40  放弃容易坚持一定很帅  阅读(631)  评论(0编辑  收藏  举报

导航