栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Property ‘mapperLocations‘ was not specified or no matching resources found

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Property ‘mapperLocations‘ was not specified or no matching resources found

文章目录
  • 1、问题描述
  • 2、问题原因
    • 2.1 在application.yml文件中配置mapper-locations
    • 2.2 在pom.xml文件中指定mapper.xml位置

1、问题描述
Property 'mapperLocations' was not specified or no matching resources found

​   今天在使用mybatisplus启动项目的时候,控制台输出了如下日志,这是由于xml文件没有被扫描到导致的。

​    我的项目结构如下

​ 我们可以去查看targets目录下面生产的文件,发现并没有xml后缀的文件。

2、问题原因

​  springboot项目启动的时候,src/main/java目录里只会扫描.java文件,而我的mapper.xml也是放在这个目录下的,导致它不能被扫描到。所以我们需要指定mapper.xml文件的位置。

2.1 在application.yml文件中配置mapper-locations
mapper-locations: classpath:com/weibo/message/mapper/xml/*.xml

路径根据自己的情况设置,或者为了方便直接写成classpath:**/mapper/xml**.xml src/main/resources

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/677953.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号