boot(1.4.0) \"Pageable\" for pagination.It works fine without any issue.But by default the page value starts from \"0\" but in the front-end the page value starts from \"1\". So
If you are using Spring Boot 2.X you could switch from WebMvcConfigurerAdapter
to application properties. There is a set of properties to configure pageable:
# DATA WEB (SpringDataWebProperties)
spring.data.web.pageable.default-page-size=20 # Default page size.
spring.data.web.pageable.max-page-size=2000 # Maximum page size to be accepted.
spring.data.web.pageable.one-indexed-parameters=false # Whether to expose and assume 1-based page number indexes.
spring.data.web.pageable.page-parameter=page # Page index parameter name.
spring.data.web.pageable.prefix= # General prefix to be prepended to the page number and page size parameters.
spring.data.web.pageable.qualifier-delimiter=_ # Delimiter to be used between the qualifier and the actual page number and size properties.
spring.data.web.pageable.size-parameter=size # Page size parameter name.
spring.data.web.sort.sort-parameter=sort # Sort parameter name.
But please remember that even if you change the one-indexed-parameter
the page response (PageImpl
class) will return results with zero-based page number. It could be a little misleading.