他们俩的依赖不同:

mybatis的依赖:

<dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.4</version>
        </dependency>

一般这个依赖你在创建springboot的项目时,勾选了mybatis时,pom.xml文件中就已经有了这个依赖

对应的application.yml文件(或者application.propertity)配置如下所示:

mybatis:    #设置mapper的路径和实体
  mapper-locations: classpath*:mapper/*Mapper.xml
  type-aliases-package: com.qc.qc_blog.entity

 

而mybatis-plus的依赖:

<dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus</artifactId>
            <version>2.3</version>
        </dependency>

<!--         https://mvnrepository/artifact/com.baomidou/mybatis-plus-boot-starter-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>2.3</version>
        </dependency>

对应的application.yml文件(或者application.propertity)配置如下所示:

mybatis-plus:    #设置mapper的路径和实体
  mapper-locations: classpath*:mapper/*Mapper.xml
  type-aliases-package: com.qc.qc_blog.entity

注意查看mapper-locations有没有写对,没有写对时,IDEA会将其标出:

如下图少了一个s(其他的一些规范的命名也一样,少一个字母都不行):

我是不会说,某次我因为这个原因找了很久没找到问题所在的,注意查看yml文件

更多推荐

关于mybatis和mybatis-plus两个依赖