当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Anaconda安装labelImg图像标注软件
- ECCV2022:在Transformer上进行递归,不增参数,计算量还少!
- 365天挑战LeetCode1000题——Day 044 最大层内元素和 层次遍历
- Getting started with jmeter performance testing steps (performance testing tool jmeter)
- 深圳某游戏研发公司每个工位都装监控,网友:堪比“坐牢”!
- 基本语法(一)
- The cluster of safe mode
- 行业案例 | 全面防护 赛宁助力能源工控安全建设
- 365-day challenge LeetCode1000 questions - Day 044 Maximum element in the layer and level traversal
- Use IN List Population in Your JDBC Application to Avoid Cursor Cache Contention Issues
猜你喜欢
随机推荐
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
vivado里那些看不懂的原语
基于模糊预测与扩展卡尔曼滤波的野值剔除方法
Flutter keyboard visibility
PAT考试总结(考试心得)
2022年最新重庆建筑安全员模拟题库及答案
Two methods of NameNode failure handling
Cognitive-exercise rehabilitation medical robot application design
0x80070570 The file or directory is damaged and cannot be deleted (how to delete 0x80070091)
攻防演练丨赛宁红方管控平台走进广东三地 助力数字政府网络安全建设
CentOS7 installation MySQL graphic detailed tutorial
Build a Valentine's Day confession website (super detailed process, package teaching package)
使用docker搭建mysql主从
PyQt5 rapid development and actual combat 10.1 Get city weather forecast
电脑重要文件很多,如何备份比较安全?
Structural controllability of switched linear systems with symmetry constraints
基于神经网络的多柔性梁耦合结构振动控制
SAP 电商云 Spartacus UI 和 Accelerator UI 里的 ASM 模块
Introduction to using NPM
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)