IDEA 使用junit 做单元测试遇到的问题
作者:互联网
报错信息: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"
是不是使用了” ** “符号表示,需要将他替换成具体的目录!!!!!!
标签:xml,mapper,false,单元测试,IDEA,java,mapperLocations,junit,resources 来源: https://www.cnblogs.com/qinda/p/13038078.html