首页 > 其他 > 详细

IDEA 使用junit 做单元测试遇到的问题

时间:2020-06-03 16:05:09      阅读:42      评论:0      收藏:0      [点我收藏+]

报错信息:Invalid bound statement (not found):  找不到绑定的mapper

解决步骤

看target 目录下是否存在mapper.xml 文件,如果不存在的话,应该是因为你的mapper.xml是放在java文件夹下,而不是resources目录下。这就需要在pom.xml文件下配置resources

技术分享图片
<resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
View Code

如果还是不行就看下 mapperLocations 的配置路径   mapperLocations="classpath:com/**/mapper/*.xml"

是不是使用了”  **  “符号表示,需要将他替换成具体的目录!!!!!!

IDEA 使用junit 做单元测试遇到的问题

原文:https://www.cnblogs.com/qinda/p/13038078.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!