在使用mybatis-plus
中,在xml
文件中手撸了一个SQL
语句。在service
中使用baseMapper
调用xml
中方法时,报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
。根据以往的经验,分析如下:
-
mybatis-plus
的配置问题,导致springboot
无法扫描到对应的domain
,mapper
,xml
文件,检查application.yml
中mybatis-plus
的配置,是否包含要扫描的文件
-
- 检查
mybatis-plus
的版本和xml
中<!DOCTYPE mapper···>
的版本
- 检查
-
pom中
是否配置打包时包含xml
文件
-
- 手动在
Resource
目录下创建xml
目录时,如果是多层目录使用/
分割,不能使用.
分割。
使用.
分割会导致Resource
下的xml
路径和1
中配置的扫描xml
路径不匹配
- 手动在