当前位置:网站首页>Invalid bound statement (not found)出现的原因和解决方法
Invalid bound statement (not found)出现的原因和解决方法
2022-07-31 12:56:00 【m0_67403240】
解决错误的步骤
出现了什么错误
错误截图:
//BindingException 数据绑定异常 not found 找不到
org.apache.ibatis.binding.BindingException:
Invalid bound statement (not found): com.kuan.edu.mapper.CourseMapper.getPublishCourseInfo
可能导致的原因
出现这个错误可能的原因:
- mapper文件和xml中的方法名是否一致
一般这个都不会出问题 - maven默认加载机制造成的问题
maven加载的时候,把java文件夹里面的.java类型文件进行编译,其他类型的文件,并不会加载
解决办法
解决方法:
复制xml到target目录中(不推荐)
把xml文件放到resources目录中(不推荐)
通过配置实现
(1)在pom.xml文件进行配置,让maven默认加载xml文件,然后就重新构建一下<!-- 项目打包时会将java目录中的*.xml文件也进行打包 --> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build>
构建完了之后我们可以看到在target中xml文件出现了
(2) 在Spring Boot配置文件application.proper中添加配置(注意路径要改成你xml所在的地方)
#配置mapper xml文件的路径
mybatis-plus.mapper-locations=classpath:com/kuan/edu/mapper/xml/*.xml
上面两步缺一不可,这样问题就解决了。
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- C# 中的Async 和 Await 的用法详解
- Hard disk partition, expand disk C, no reshipment system, not heavy D dish of software full tutorial.
- 函数递归1.0
- Architecture Camp | Module 8
- CentOS7 —— yum安装mysql
- 全局平均池化层替代全连接层(最大池化和平均池化的区别)
- Character Functions and String Functions
- 阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?
- 365天挑战LeetCode1000题——Day 044 最大层内元素和 层次遍历
- SAP 电商云 Spartacus UI 和 Accelerator UI 里的 ASM 模块
猜你喜欢
随机推荐
基于去噪自编码器的故障隔离与识别方法
PyQt5 rapid development and actual combat 10.1 Get city weather forecast
Flutter键盘可见性
TensorRT安装及使用教程「建议收藏」
行业案例 | 全面防护 赛宁助力能源工控安全建设
The cluster of safe mode
C# 中的Async 和 Await 的用法详解
基本语法(一)
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
[core]-ARMV7-A, ARMV8-A, ARMV9-A Architecture Introduction "Recommended Collection"
Getting started with jmeter performance testing steps (performance testing tool jmeter)
PAT考试总结(考试心得)
基于稳态视觉诱发电位和注意力脑电的混合脑机接口系统
ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
centos7安装mysql5.7
ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
PyQt5快速开发与实战 10.1 获取城市天气预报
[Shader] Shader official example [easy to understand]
求一份常见Oracle故障模拟场景
中望3D 2023正式发布,设计仿真制造一体化缩短产品开发周期