[mybatis] [报错] org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

问题

如题

解决方案

搜了一圈csdn ,各种名字都是对应的,mapperScan的路径也正确,去了stackoverflow,
搜到了另一个解决方案:
https://stackoverflow.com/questions/33478990/mybatis-org-apache-ibatis-binding-bindingexception-invalid-bound-statement-not

I once made a similar mistake which turned out that the directories were incorrect.
If the UserMapper’s namespace is com.mybatisdemo.mappers.UserMapper, make sure mapper-locations is src/resources/com/mybatisdemo/mappers/.
Sometimes we might create a directory named com.mybatisdemo.mappers, then its location turns out to be src/resources/com.mybatisdemo.mappers which is wrong.

也就是说 ,src里的XXmapper.java文件路径,要和resource里的路径对应,
在这里插入图片描述
我这里一开始直接把xml放resources里,一直报错。
按我图里的路径试了一下就好了。

猜你喜欢

转载自blog.csdn.net/gongfpp/article/details/126178625