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

1.报错:

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:52182', transport: 'socket'

Process finished with exit code 1 

2.出现这个问题的原因

可能是你的某个A模块里,导入了需要mysql链接的B模块,但是你的A模块里没有配置相关连接url。或者没有读取到。

比如,你的网关模块里,导入你的处理业务orderService的模块,而orderService里需要mysql连接。这个时候,就会报错。

3.怎么查看和修复呢?

idea 最上面有个view - Tool Windows 打开,找到Dependencies

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource_第1张图片

4.看冲突的模块里,是否有“compile”。

4.1点右边“Used in”展开后,可以删除该依赖。再重启主启动类试试

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource_第2张图片

你可能感兴趣的:(数据库,mybatis)