springboot报错记录

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-06-29 15:45:54.553 ERROR 8176 --- [           main] 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

原因:


  spring boot默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类,DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。


解决方法:


  在Application类上增加@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) 或者 配置dataSource

猜你喜欢

转载自blog.csdn.net/Suviky/article/details/80857849