多数据源Imybatisplus nvalid bound statement not found
时间: 2023-11-17 20:01:50 浏览: 38
多数据源下出现mybatisplus Invalid bound statement (not found)的问题,可能是因为在配置多数据源时,没有正确指定Mapper的位置。可以尝试在配置文件中指定Mapper的位置,例如:
```
mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
```
其中,mapper-locations指定了Mapper的位置,classpath*:mapper/**/*.xml表示在classpath下的mapper目录及其子目录下查找.xml文件作为Mapper文件。
相关问题
mybatisplus nvalid bound statement (not found)
引用引用引用综上所述,解决mybatisplus "Invalid bound statement (not found)"错误的方法包括删除mapper中的空白行、更改数据库驱动、检查配置和书写是否有误、确保target文件夹加载了配置和映射文件,并且通过IDEA编辑器来检查XML中Mapper的路径是否正确。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [nvalid bound statement (not found):mybatis](https://blog.csdn.net/qq_44136011/article/details/127300634)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [IDEA nvalid bound statement (not found) ... with root cause](https://blog.csdn.net/suoyue_py/article/details/108829807)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [nvalid bound statement (not found)解决办法](https://blog.csdn.net/weixin_43823759/article/details/116015615)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
nvalid bound statement (not found):
Invalid bound statement (not found)是Mybatis中常见的错误。它通常由以下几种可能导致:
1. mapper方法名和mapper.xml中的id名不一致导致的。在mapper接口定义的方法名应该和对应的mapper.xml文件中定义的id名保持一致。如果不一致,就会导致Invalid bound statement (not found)错误。
2. 使用了Mybatisplus框架搭建项目时,调用mapper方法查询数据库时可能会报错Invalid bound statement (not found)。解决方案是在pom.xml文件中配置resource节点,确保mapper.xml文件能够被正确加载。
另外,还有一种解决方案是使用一个插件来帮助我们定位错误。这个插件可以在mapper接口和对应的mapper.xml文件之间添加一个小鸟图标,方便我们快速跳转到对应的文件进行修改。
所以,当出现Invalid bound statement (not found)错误时,我们可以首先检查mapper方法名和mapper.xml中的id名是否一致,然后确认配置文件是否正确加载,如果需要,可以使用插件来辅助定位错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>