mybatis-plus的@Select注解产生的mybatis问题Compatible version of org.apache.itabis.annotations.Select
一、问题描述
在项目中用了mybatis-plus又用了mybatis,导致项目启动进行mapper扫描的时候,程序不知道用哪个mybatis的依赖导致的一系列问题。
切记:
如果启动类为注明@MapperScan,请一定老老实实在mapper或者dao层的接口上,标注@Mapper,不要在用@Repository安慰自己了,没毛用。
二、问题解决
排除mybatis启动类中的mybatis依赖
# 父依赖<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> </parent># mybatis-plus<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.2.0</version> </dependency># mybatis <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.1</version> <exclusions> <exclusion> <groupId>org.mybatis</groupId><artifactId>mybatis</artifactId> </exclusion> <exclusion> <groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId> </exclusion></exclusions> </dependency> # pagehelper <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.5</version> <exclusions> <exclusion> <groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId> </exclusion></exclusions> </dependency>