报错: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

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

相关推荐
Hui Baby1 天前
回顾-springboot自定义xml
xml·java·spring boot
开始了码2 天前
XML文件介绍和QT相关操作
xml·qt
Andy工程师2 天前
logback-spring.xml优先级更高
xml·spring·logback
小江村儿的文杰2 天前
UE4在MacOS上将Commit.gitdeps.xml设为Git LFS文件的潜在弊端
xml·ue4
humstone3 天前
基于xml 和sql 实现自定义报表查询
xml·数据库·sql
就叫飞六吧3 天前
考古spring.xml注册bean无法扫描目录问题
xml·java·spring
Star abuse4 天前
XML转YOLO格式数据集教程
xml·人工智能·yolo
gAlAxy...4 天前
MyBatis 核心配置文件 SqlMapConfig.xml 全解析
xml·mybatis
编程修仙5 天前
第十一篇 Spring事务
xml·java·数据库·spring
金士顿5 天前
Ethercat耦合器添加的IO导出xml 初始化IO参数
android·xml·java