Is there a prebuilt framework for handling cursor-based pagination in the Springframework?

Viewed 112

I'm looking to implement cursor based pagination on a large number of endpoints across multiple spring microservice API's. I'm looking for a dependency I can inject and implement in the same or similar way that Offset pagination is handled in spring-boot by default.

In other words:

  • Standardized Page response & request objects.
  • Standardized annotations.

Handling using Offset pagination is built into spring:

public Page<SomeDTO> nextPage(@PageableDefault(size = 5, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable,
                    @ApiParam(name = "tabFilter") @RequestParam(value = "tabFilter", required = false, defaultValue = "CREATED_BY_ME") String tabFilter,
                    @ApiParam(name = "status") @RequestParam(value = "status", required = false) String status,
                    ...){

But I need a similar way to standardize it accross classes (preferably without building custom DTO's / Annotations.

Using:

Java 8
Spring-boot 2.4.2
spring 5.3.3

0 Answers
Related