天天看点

初学者启动springboot报错

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-03-25 16:27:02.807 ERROR 16256 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
Reason: Failed to determine a suitable driver class

Action:

Consider the following situation:
If you want an embedded database like H2, HSQL or Derby, please add it in the Classpath.
If you have database settings to be loaded from a particular profile you may need to activate it since no profiles were currently active.
           

报错显示无法找到数据源!Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified and no embedded

原因是:pom配置文件中mysql未成功配置

第一种解决方式:在启动类springbootapplication后加上(exclude={DataSourceAutoConfiguration.class}),表示暂时不需要数据库组件

第二种解决方式:pom配置文件中mysql依赖重新添加成功。

按照以上方式便可成功启动。