org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example...... 发生这样的问题原因有以下几点
1.mapper接口类全名与mapper.xml的namespace不一致
2.mapper接口的方法与mapper.xml的id不一致
3.mapper.xml的中文注释造成(去掉中文注释)
4.mapper.xml的路径与配置的不一致
例如:
mapper.xml位置在resources/mapper/mapper.xml但是你的mybatis配置确是
(mybatis:
mapperLocations: classpath:mapper/*/*.xml)
这样只能扫描到不到mapper/mapper.xml
正确的配置是
mybatis:
mapperLocations: classpath:mapper/*.xml或者将mapper.xml放到resources/mapper/*/mapper.xml的位置(*表示任何文件夹名称)
5.idea中的resources有个标志如果没有则需要设置成resources
选择file-->Project Structure-->Moudules-->选择项目的resources文件夹-->点击Resources-->ok
6.注解或者xml的sql语句的特殊符号导致的语法不正确
> 使用>替换
< 使用<替换
>= 使用>e;替换
<= 使用<e;替换
"使用"替换
'使用'替换
xml当中使用<![CDATA[]]>包裹特殊符号不会被解析
注意:本文归作者所有,未经作者允许,不得转载