错误:
启动错误信息:
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).
1、项目不需要使用 DataSource,但是引用了JPA的数据包,这里需要在启动类上增加:
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }
排除数据源的自动配置类。
2、项目使用了Druid, 这时而又非原生的配置,比如增加了动态数据源支持。这时需要在启动类上增加:
@SpringBootApplication(exclude ={DruidDataSourceAutoConfigure.class} )
排除掉Druid的数据源的自动配置类。