Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-12 18:44:45.365 ERROR 13480 --- [           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


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).

 

出现这个问题的原因是:

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

解决的方法:

SpringBoot启动异常 Error starting ApplicationContext.

加入红色框框的代码.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
  • 2022-12-23
  • 2021-12-24
  • 2021-04-22
猜你喜欢
  • 2022-01-19
  • 2022-12-23
  • 2021-04-17
  • 2021-04-18
  • 2022-12-23
  • 2021-07-05
  • 2021-08-05
相关资源
相似解决方案