org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yk.springboot.service.UserService.findAllUser
时间: 2023-08-17 16:12:24 浏览: 172
MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法
引用\[1\]:即错误信息为:nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cloud.lowcode.mapper.UserMapper.queryByParam。引用\[3\]:总结解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)方法 问题背景:在做SpringBoot项目的时候,通过controller层调用service层的接口时出现了如下的报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.service.UserService.getById at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235) ~\[mybatis-3.5.2.jar:3.5.2\] at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:49) ~\[mybatis-plus-core-3.2.0.jar:3.2.0\] at com.example.controller.UserController.obj(UserController.java:18) ~\[classes/:na\] 1.问题原因是由于dao层(也可以叫做mapper接口)跟mapper.xml文件没有映射,而大部分的原因有如下的几种类型: dao层的方法跟mapper.xml的方法不一样,mapper.xml中的namespace要写对应的dao层和entity层不一样,spring配置文件中mybatis与xml文件路径的配置没有写,导致无法映射成功,拼写错误导致。\[3\]根据你提供的错误信息,可以推断出你的问题是在调用com.yk.springboot.service.UserService.findAllUser方法时出现了org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)的错误。这个错误通常是由于mapper接口与mapper.xml文件没有正确映射导致的。你可以检查以下几个方面来解决这个问题:1. 确保你的mapper接口中的方法名与mapper.xml文件中的statement id一致;2. 确保mapper.xml文件中的namespace与mapper接口的包路径一致;3. 检查你的spring配置文件中是否正确配置了mybatis与xml文件路径的映射关系;4. 检查你的代码中是否存在拼写错误。希望这些解决方法能够帮助你解决问题。
#### 引用[.reference_title]
- *1* *2* [解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):xxx问题](https://blog.csdn.net/lvoelife/article/details/128017529)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [总结mybatis plus解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)...](https://blog.csdn.net/weixin_44106947/article/details/122910406)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文