通过maven引入分别引入pagehelper包和mybatis-plus包
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> </dependency>在启动时却抛出了奇怪的异常ClassNotFoundException: org.mybatis.logging.LoggerFactory 经过一顿排查,发现pagehelper-spring-boot-starter引入了mybatis和spring的整合包,即mybatis-spring,而mybatis-plus-boot-starter也引入了相关的包。 本人此处的pagehelper使用mybatis-spring的版本是1.3.2的,而mybatis-plus引入的是2.0.0的,在尝试移除mybatis-plus下mybatis-spring包,发现问题得不到解决,转而移除pagehelper下的mybatis-spring包后,成功启动!
修改如下: <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <exclusions> <exclusion> <artifactId>mybatis-spring</artifactId> <groupId>org.mybatis</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> </dependency>