PageHelper connot be cast to org.apache.ibatis.plugin.Interceptor

由于自己的分页插件的版本较高,我用的是5.2.0。出现了标题的问题。于是开始解决:

刚开始 分页插件的配置

<plugins>
<plugin interceptor="com.github.pagehelper.PageHelper">
<property name="dialect" value="mysql"/>
</plugin>

</plugins>

  根据提示这是一个类型转换的错误。于是点进去发现 PageHelper根本没有实现Interceptor接口。在看分页插件的类时,发现PageInterceptor类实现了Interceptor接口。于是修改配置

<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="properties" value="mysql"/>
</plugin>

</plugins>

这样就完美就可以使用分页插件了。

猜你喜欢

转载自blog.csdn.net/monody666/article/details/113680040