今天完成项目环境的搭建,并成功剥离TestMrl相关接口,并成功运行
遇到的问题:

缺少
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>和
   <build><!-- 构建项目需要的信息 -->
        <resources><!-- 这个元素描述了项目相关的所有资源路径列表,例如和项目相关的属性文件,这些资源被包含在
                        最终的打包文件里。 -->
            <resource>  <!-- 这个元素描述了项目相关或测试相关的所有资源路径 -->
                <directory>src/main/resources/</directory> <!-- 描述存放资源的目录,该路径相对POM路径 -->
                <filtering>true</filtering><!-- 是否使用参数值代替参数名。参数值取自properties元素或者文件里配置的属性,文件在filters元素里列出。 -->
                <includes><!-- 包含的模式列表,例如**/*.xml. -->
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <plugins><!-- 使用的插件列表 。 -->
            <plugin> <!-- plugin元素包含描述插件所需要的信息。 -->
                <groupId>org.springframework.boot</groupId>  <!-- 插件在仓库里的group ID -->
                <artifactId>spring-boot-maven-plugin</artifactId> <!-- 插件在仓库里的artifact ID -->
                <version>2.5.3</version><!-- 被使用的插件的版本(或版本范围) -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration><!-- 作为DOM对象的配置 -->
                    <!-- 使用默认的变量标记方法即${*} -->
                    <useDefaultDelimiters>true</useDefaultDelimiters>
                </configuration>
            </plugin>
        </plugins>
    </build>后报错:
NoClassDefFoundError:
tk/mybatis/mapper/mapperhelper/MapperTemplate
解决:添加注解
<dependency>
      <groupId>tk.mybatis</groupId>
      <artifactId>mapper-spring-boot-starter</artifactId>
      <version>2.0.4</version>
    </dependency>后通过Maven-生命周期-clean-install,定位jdk版本过高的问题,更换jdk1.8解决;
springboot3.0.0版本过高,与部分依赖不兼容,调整至2.5.3版本;
后报错:
Caused by: java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory
原因:mybatis-spring-boot与mybatis-plus冲突
解决:
刚开始,因为mybatis-plus整合了mybatis-spring-boot,所以尝试删除mybatis-spring-boot,
但是删除后mapper-spring-boot-starter依旧使用mybatis-spring-boot,依旧不能·解决冲突问题,
然后看网上说两个版本接近可以避免冲突,遂调整版本。
在多次尝试无果后,一次手误把mybatis-plus依赖删除,程序正常运行了!!!
我早怎么没想到呢。。。
程序运行了,我开始测试接口功能,有的好用,有的不好用
报错:
 
报错原因:TestMrlMapper.xml找不到
解决:
核对映射地址;
核对方法名;
重连数据库;
检查pom.xml的中配置resource;
都没找到问题。
最后发现:

配置文件里用的还是mybatis-plus,改成:
 
over!
测试都通过。
这一天都在跟mybatis斗智斗勇。。。



















