Invalid bound statement (not found)
1.检查xml文件所在package名称是否和Mapper interface所在的包名
2.mapper的namespace是否正确。
<mapper namespace=“com.he.mapper.UserDao”>
3.UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此
4.看下mapper的XML配置路径是否正确
mybatis:
mapper-locations: classpath*:com/he/mapper/**/*.xml
type-aliases-package: com.he.mapper
我觉得如果你来到了这里,应该不是上面的问题。
注意前方高能
在 resources 下建立文件夹要依次新建,不能像下面这样建立,这样会被认为是一个文件名。
正确建立方法是
第一种:先在 resources 下建立 com, 然后在 com 下建立 he,再在 he 下面建立 mapper。
第二种:com/he/mapper
坑
坑
坑