Java报错:Cause: java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper
Cause: java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper
·
使用PageHelper分页插件报错如下:
可是我这边引入了PageHelper的依赖的,如下:
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.1.3</version>
</dependency>
百度了一下,发现应该是在Mybatis配置文件中的分页插件拦截器配置错了,如下:
仔细看了一下,的确是错的,上述com.github.pagehelper仅仅是一个包,而不是一个类,把它修改如下就可以了。
<plugins>
<plugin interceptor="com.github.pagehelper.PageHelper"/>
</plugins>
发现这个类下有实现了拦截器接口,如下:
运行结果如下:
如果使用的版本是5.0及以上,则在MyBatis配置文件中的拦截器选项需要设置成这个值。
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.3.1</version>
</dependency>
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor"/>
</plugins>
运行结果如下:
和上面一样,正常输出哈。。
更多推荐
所有评论(0)