学习使我快乐!!!

Mybatis报错 java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper.PageInterceptor

问题描述

学习mybatis时使用的了一个插件:PageHelper。结果报错:java.lang.ClassNotFoundException: Cannot find class:com.github.pagehelper.PageInterceptor

1.检查在pom.xml文件中加入依赖

        <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>5.3.2</version>
<!--            <version>5.2.0</version>-->
        </dependency>

2.检查在mybatis的配置文件中加入PageInterceptor插件

<!--分页配置插件-->
    <plugins>
        <plugin interceptor="com.github.pagehelper.PageInterceptor" />
    </plugins>

上述文件检查过后,没有出现问题。但是还是会报错。

问题解决

在pom.xml文件中,选择最新的版本。此时是5.3.2,就能正常使用了!!!

在以下链接下载最新版本:

Mybatis-PageHelper/HowToUse.md at master · pagehelper/Mybatis-PageHelper · GitHub

posted @ 2022-10-21 20:16  yyyyyu  阅读(216)  评论(0)    收藏  举报