Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value
程序员文章站
2022-06-12 22:58:27
...
第一次用idea这个软件,遇到这个问题很是头疼
百度一波后发现好尴尬:
1.pom.xml配置问题所导致的,结果target里面没有你的mapper.xml编译文件。
解决:在pom.xml里添加
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
2.mapper.xml文件里对的配置有问题,比如说①id和同文件下的mapper.java里的方法名字不一致等等②namesapce的路径写错了
解决:复制方法名,减少错误,namesapce路径是dao层的mapper.xml的路径
3这个就是我犯得错很深刻。他不是以上错误导致的,而是idea的项目在建造的时候导致的。可以看到,正确的建包的结构和target的目录结构几乎一致。
错误的已经修改掉了,拿eclipse的包结构代替一下,将就看看
这个mapper和mapper.xml在一起但是这种结构会导致编译后的文件不在一起,这就会报错!
这个就是正确的,正确的两个编译后的文件在一起。
至此错误解决!个人见解,有什么不对之处,欢迎大佬批评!!
推荐阅读
-
moven 部署Sping与mybatis时,Mapped Statements collection does not contain value for Xxxxxxxx
-
Mybatis:Mapped Statements collection does not contain value for
-
Mapped Statements collection does not contain value for Xxxx
-
Mapped Statements collection does not contain value for XXX
-
Mapped Statements collection does not contain value for
-
Mapped Statements collection does not contain value for xxx
-
[email protected]使用报错:Mapped Statements collection does not contain value for XXX
-
mybatis错误 Mapped Statements collection does not contain value for
-
Mapped Statements collection does not contain value for
-
Mybatis报错—— Mapped Statements collection does not contain value for com.mapper.DepartmentMapper