Description: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded dat

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

Disconnected from the target VM, address: '127.0.0.1:54478', transport: 'socket'

原因:因为依赖别的项目的pom文件导入了mybatis的数据源依赖,项目启动时会进行自动配置,而我的这个项目没有使用数据源相关操作,所以报了异常。

解决:在启动类注解上加上 exclude = DataSourceAutoConfiguration.class

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

另一个解决办法是也可以在pom文件中进行排除。

猜你喜欢

转载自blog.csdn.net/qq_33767353/article/details/108911399