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

报错:Parsed mapper file: ‘file mapper.xml_第1张图片

 application无法启动

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

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

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

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

取消掉断点    报错还是依旧

报错:Parsed mapper file: ‘file mapper.xml_第2张图片

报错:Parsed mapper file: ‘file mapper.xml_第3张图片

打钩的先全部取消掉

报错:Parsed mapper file: ‘file mapper.xml_第4张图片

报错:Parsed mapper file: ‘file mapper.xml_第5张图片

最后的问题是项目没有识别到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文件中 配置一下


    
        
            src/main/java/
            
                **/*.xml
            
        

applicaton,yml中的配置

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

报错:Parsed mapper file: ‘file mapper.xml_第6张图片

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

你可能感兴趣的:(xml)