首页 > 其他分享 >mybatis整合在springboot中时,出现 class path resource [mapper/*.xml] cannot be opened because it does not ex

mybatis整合在springboot中时,出现 class path resource [mapper/*.xml] cannot be opened because it does not ex

时间:2022-11-08 15:44:46浏览次数:44  
标签:xml mapper resource springboot 配置文件 cannot mybatis

如图所示,报错如下

 

 可以看到它提示说我的resource下面没有mapper/*.xml相关的文件,当时就给我整蒙了

我一查target文件夹

 

 发现我的UserMapper在

 

最后才找到问题所在,在配置文件中如下两个:

# 指定 mybatis 映射文件位置
mybatis.config-locations=classpath:xxx/*.xml

# locations写错成location,springboot就找MyBatis主配置文件,如果这个文件没有就会报错
mybatis.config-location=classpath:xxx/*.xml

 

少写一个s,疯狂找bug

标签:xml,mapper,resource,springboot,配置文件,cannot,mybatis
From: https://www.cnblogs.com/lhbilibili/p/16869902.html

相关文章