项目场景:
springboot和Mybatis整合使用时
问题描述
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题
原因分析:
在mybatis中mapper接口与mapper配置文件在做映射绑定的时候出现问题,就是接口与xml找不到或者匹配不上!!
解决方案:
1、检查xml文件名和mapper接口名是否一致
2、UserMapper接口中的方法在UserMapper.xml中没有时,也会报错
3、使用springboot时查看application时查看application.properties或者.yml中的配置路径是否正确
4、使用Spring时就查看spring-dao.xml中的配置看是否出错
5、如果以上还没有解决,就查看xml文件名和mapper接口所在包的名称是否一致,不一致也可能导致错误