关于class path resource [mapper/*Mapper.xml] cannot be opened because it does no exists

本文记录了在使用SpringBoot整合Mybatis时遇到的mapper文件找不到的问题,问题源于配置文件中mybatis.config-location的错误写法。正确配置应为mybatis.mapper-locations=classpath:mapper/*Mapper.xml,而非mybatis.config-location=classpath:mapper/*Mapper.xml。通过调整这一配置,成功解决了XML文件无法被加载的问题。
部署运行你感兴趣的模型镜像

关于class path resource [mapper/*Mapper.xml] cannot be opened because it does no exists异常的一些记录

这是用springboot整合mybatis时遇到的一个小问题,问题虽小,但是也耽误了很多时间,搜了很多博客,但大多都是复制粘贴的废话,说不到点子上,最终花了蛮久才找到一个有用的。特此记录一下。

关于问题:

问题讲的是mapper文件不存在,那要么就是你真的没有这个文件,要么就是application.properties(或者application.yaml)配置出错了。我就是配置文件写错了。。。

我之前写的,这样找不到xml文件内:

mybatis.config-location=classpath:mapper/*Mapper.xml

要用下面这样就可以了:

mybatis.mapper-locations=classpath:mapper/*Mapper.xml

您可能感兴趣的与本文相关的镜像

GPT-SoVITS

GPT-SoVITS

AI应用

GPT-SoVITS 是一个开源的文本到语音(TTS)和语音转换模型,它结合了 GPT 的生成能力和 SoVITS 的语音转换技术。该项目以其强大的声音克隆能力而闻名,仅需少量语音样本(如5秒)即可实现高质量的即时语音合成,也可通过更长的音频(如1分钟)进行微调以获得更逼真的效果

根据提供的引用内容,问题是关于一个文件路径的错误。根据引用\[1\]和引用\[2\],错误信息显示"class path resource \[config/mybatis/mapper3/\] cannot be resolved to URL because it does not exist",这意味着指定的文件路径不存在。根据引用\[3\]中的配置信息,可以看到mybatis的配置文件应该位于"classpath:mybatis/mybatis-config.xml"。因此,问题中提到的文件路径应该是错误的,可能是拼写错误或者文件确实不存在。请检查文件路径是否正确,并确保文件存在于指定的位置。 #### 引用[.reference_title] - *1* *2* [class path resource [config/mybatis/mapper3/] cannot be resolved to URL because it does not exist](https://blog.csdn.net/qq_39308071/article/details/108099653)[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^v4^insert_chatgpt"}} ] [.reference_item] - *3* [【springboot】class path resource [mybatis/mybatis-config.xml] cannot be opened because it does not ...](https://blog.csdn.net/Mrerlou/article/details/120723471)[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^v4^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值