问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

问题:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

我在学习mybatis框架的过程中,遇到这个问题,找了很久都没找到问题出在哪,一直找,一直找,原来是我mapper.xml中sql标签的id多了一个空格(哭了,不仔细对比真的很难发现)
这个问题的根源其实是在mapper配置文件与dao接口做映射绑定时候出现的问题,接口与响应的xml找不到,或者是匹配不到,一般出现这个问题,只需要按照以下步骤去检查执行就可以解决:
1、mapper.xml的namespace是否是对应接口类的全名(包括包名和类名):这个是必须要保证相同,需要进行检查,而且全类名最好复制过来。
问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
2、 mapper接口类和mapper.xml是否在同一个包下(或者包结构是否一致),文件名称是否一致(仅后缀不同)
问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
3、mapper接口类的方法名是否与mapper.xml中sql标签的id相同:这个也需要进行检查,必须保证一致 !多一个空格也不行!!!我就是挂在这了
问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
问题(mybatis):org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
希望对你们有帮助!!