java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.github.pagehelper.Page
at com.estate.service.impl.CommunityServiceImpl.search(CommunityServiceImpl.java:83) ~[classes/:na]
at com.estate.controller.CommunityController.search(CommunityController.java:38) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_301]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_301]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_301]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_301]
分析原因
1.maven的依赖有问题
2.PageHelper的使用有问题
解决办法
1.如果是原因1直接clean掉maven在重新compile就可以
2.如果是原因2需要特别注意PageHelper需要紧跟着select语句,不然可能会报错,如图正确演示