I'm trying to implement Pagination in my Reactive WebFlux app and my DB is Couchbase.
The Spring Data Couchbase doc allows me to pass Pageable as an argument in my Repository.
Flux<Person> findByFirstnameOrderByLastname(String firstname, Pageable pageable);
However, when I try to implement it I get the below error:
Caused by: java.lang.IllegalStateException: Method has to have one of the following return types! [interface org.springframework.data.domain.Slice, interface java.util.List, interface org.springframework.data.domain.Page]
My Repository method looks like this:
Flux<Building> findAll(Pageable pageable);
However, if I use this workaround, I've no problem.
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} LIMIT $1 OFFSET $2")
Flux<Building> findAll(Integer limit, Integer offset);
Is this a bug? Or, am I using it wrong?
Spring Boot version: 2.2.7.RELEASE
Full Repository:
@Repository
public interface BuildingRepository extends ReactiveSortingRepository<Building, String> {
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} LIMIT $1 OFFSET $2")
Flux<Building> findAll(Integer limit, Integer offset);
//This works if I comment the below
Flux<Building> findAll(Pageable pageable);
}