org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.lcl.dao.IUserDao.InsertUserService
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.lcl.dao.IUserDao.InsertUserService
报错解决方案:
如果此方法不可用,那么建议搜索查看其他解决方法内容
那么正文如下:
先导:有的是在类包下创建配置文件,那么需要在 pom 中配置 build ,这里没有采用那种方法 。这里讲的是直接在resource下配置文件。
原因:其实很简单,就是找不到 mapper 的匹配路径
在刚开始学习整合 springboot 和 Mybatis 时,会遇到这个问题,IDEA 默认是 编译 resource 下的 配置文件
Mybatis 的 mapper 注册 要么在 Mybatis 全局配置文件中配置:
要么在 SqlSessionFactoryBean bean 下配置:
也可以同时配置,他会先读取 bean 下的,但是没必要。
这个问题困扰了我两天,可喜可贺