spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

ClassCastException when using Slice<T> instead of Page<T>

Open toutprix opened this issue 3 years ago • 0 comments
trafficstars

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description java.lang.ClassCastException: class org.springframework.data.domain.SliceImpl cannot be cast to class org.springframework.data.domain.Page (org.springframework.data.domain.SliceImpl and org.springframework.data.domain.Page are in unnamed module of loader )

Environment Spring Batch version: 5.6.0, Java: 17, Database: couchbase, postgresql

Steps to reproduce Create respository with method: Slice<T> findAll(Pageable pageable) and use it in own RepositoryItemReader

Expected behavior It is expected that everything will work as in the case of Pageabla<T>

How has this issue affected you? Performance degradation in fetching data from couchbase

Are you aware of any workarounds? Change in org/springframework/batch/item/data/RepositoryItemReader.java:223 Page<T> curPage = (Page<T>) doInvoke(invoker); with Slice<T> curPage = (Slice<T>) doInvoke(invoker);

toutprix avatar May 18 '22 10:05 toutprix