Mybatis-关于Mapped Statements collection does not contain value for错误

使用Mybatis时不时会遇到一下这种报错:

Mapped Statements collection does not contain value for XXX

错误原因有以下几种:

  • mapper.xml中没有加入namespace
  • mapper.xml中的方法和接口mapper的方法不对应
  • mapper.xml没有加入到mybatis-config.xml中(即总的配置文件),例外:配置了mapper文件的包路径的除外
  • mapper.xml文件名和所写的mapper名称不相同
打赏
  • 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!
  • © 2017-2023 王丹鹏
  • Powered by Hexo Theme Ayer
  • 冀ICP备15029707号

请我喝杯咖啡吧~

支付宝
微信