报错:Parsed mapper file: ‘file mapper.xml

报错 :

Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Registered plugin: 'com.github.yulichang.interceptor.MPJInterceptor@3b2c8bda'
Parsed mapper file: 'file [/Mapper.xml]'

application无法启动

我这边产生原因是项目中添加了 mybayis-plus-join插件 导致这个问题

然后本人一顿骚操作:升级到JDK17 升级 到maven3.9.6 痛苦无比报错依旧,有说sql写错的。我就没几条sql 哈哈

然后 mvn clean install 构建成功 但是启动依旧报错 崩溃中。。。。。。。

取消掉所有mapper文件的extends MPJBaseMapper<> 报错依旧

取消掉断点 报错还是依旧

打钩的先全部取消掉

最后的问题是项目没有识别到mapper下的xml文件 。 路径配置问题。。需要重新导入maven

此时网上关于这个报错基本已经试完 可是我的报错依旧。。。。

相关概念:

maven项目结构:

src/main/java 默认加载java文件 一般只放java文件

src/main/resources 默认放各种配置文件,如html yaml文件 css文件,xml文件等

因此 src/main目录下的java文件编译后都在 target/classes目录下。

所有 classpath的意思是 项目根路径 也就是 target/classes

因此,将所有的xml文件放置到resources目录下 即可识别出xml文件

问题解决

但是我偏偏就是把xml想放在mapper下。 /src/main/mapper

需要再pom.xml文件中 配置一下

html 复制代码
<build>
    <resources>
        <resource>
            <directory>src/main/java/</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
        </resource>
</resources>
</build>

applicaton,yml中的配置

html 复制代码
mybatis-plus:
  mapper-locations: classpath:**/mapper/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    call-setters-on-nulls: true

但是我的问题是这样配置之后还是不识别 还是报错怎么办?

只能让idea重新指定一个配置文件 resource文件

idea-》 setting->modules-> Resources

搞定 真是太蛋疼了。。。。

相关推荐
程序猿零零漆15 小时前
Spring之旅 - 记录学习 Spring 框架的过程和经验(十一)基于XML方式、注解的声明式事务控制、Spring整合Web环境
xml·学习·spring
科雷软件测试1 天前
推荐几个常用的校验yaml、json、xml、md等多种文件格式的在线网站
xml·html·md·yaml
susu10830189111 天前
maven-3.9.12的conf配置settings.xml
xml·java·maven
odoo中国3 天前
如何在 Odoo 中从 XML 文件调用函数
xml·odoo·odoo开发·调用函数
阿凉07024 天前
新版本JLink安装目录中缺失JLinkDevices.xml添加方法
xml·嵌入式硬件
Knight_AL4 天前
从 QueryWrapper 到 XML:一次「报表 SQL」的重构实践
xml·sql·重构
智航GIS5 天前
9.5 XML 处理指南
xml·前端·python
像风一样的男人@5 天前
python --yolo混合文件xml和img整理
xml·python·yolo
飞舞花下11 天前
MAVEN私有仓库配置-Nexus私有仓库
xml·java·maven
好大的月亮11 天前
mybatis在xml中使用OGNL取值简述
xml·mybatis