美文网首页
sprboot+myBatis启动异常,Failed to co

sprboot+myBatis启动异常,Failed to co

作者: 小拇指的约定021 | 来源:发表于2020-04-21 00:09 被阅读0次

异常: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

相关文章

网友评论

      本文标题:sprboot+myBatis启动异常,Failed to co

      本文链接:https://www.haomeiwen.com/subject/fyreihtx.html