org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.demo.mapper.UserMapper.insert
时间: 2023-10-15 10:31:50 浏览: 97
出现"org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)"异常通常是因为MyBatis找不到对应的SQL语句。请注意检查以下几点,以解决这个问题:
1. 确保你的Mapper接口中的方法名与对应的mapper.xml文件中的<select>, <insert>, <update>等语句的id属性匹配。在你的问题中,异常信息显示了"com.example.demo.mapper.UserMapper.insert",说明MyBatis无法找到对应的insert语句。
2. 检查你的mapper.xml文件中的namespace是否正确指向到对应的Mapper接口类。在你的问题中,你可以确认<mapper namespace="com.swapping.springcloud.ms.integral.mapper.IntegralMapper">是否正确指向了IntegralMapper接口。
3. 如果你使用了@MapperScan注解,确保在主启动类上标注了@MapperScan注解,并指定了mapper接口所在包的全包名。注意,@MapperScan注解和@Mapper注解不能同时使用。
通过检查以上几个方面,你应该能够解决"org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)"异常。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)...](https://blog.csdn.net/weixin_34402408/article/details/86024348)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [【报错解决】org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)](https://blog.csdn.net/qq_50914927/article/details/127091350)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文