sprboot+myBatis启动异常,Failed to co
2020-04-21 本文已影响0人
小拇指的约定021
异常:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

网上出现这种问题有很多情况,尝试过很多种,以下方式解决了问题:
由于yml或者properties文件没有被扫描到,需要在pom文件中<build></build>添加如下.来保证文件都能正常被扫描到并且加载成功.

<directory>src/main/resources
<targetPath>BOOT-INF/classes/
<directory>src/main/java
<include>**/*.yml
<include>**/*.properties
<include>**/*.xml
<filtering>false
<directory>src/main/resources
<include>**/*.yml
<include>**/*.properties
<include>**/*.xml
<filtering>false
</resource>
成功解决!
本人参照第四种解决方案,特别感谢:https://www.cnblogs.com/javawxid/p/10949511.html