报错示例
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-09-27 09:14:13.402 ERROR 13440 --- [ 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).
Process finished with exit code 1
出错原因
原因:没有配置数据库组件的相关数据源信息。
解决方法
在启动类(SpringbootApplication.java)将@SpringBootApplication原注解修改为
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
添加该注解就可以取消类自动对数据源进行配置