Open spring-projects-issues opened 7 years ago
Oliver Drotbohm commented
You can extend RepositoryRestMvcConfiguration
and override the bean definition for pageableResolver()
Abhijit Sarkar commented
Ok, but I think from the following code, it's clear that the start page number is the only non-configurable property. I'm not saying that there's no workaround, but it's certainly can be easier.
@Bean
@Override
public HateoasPageableHandlerMethodArgumentResolver pageableResolver() {
HateoasPageableHandlerMethodArgumentResolver resolver = super.pageableResolver();
resolver.setPageParameterName(config().getPageParamName());
resolver.setSizeParameterName(config().getLimitParamName());
resolver.setFallbackPageable(new PageRequest(0, config().getDefaultPageSize()));
resolver.setMaxPageSize(config().getMaxPageSize());
return resolver;
}
Abhijit Sarkar opened DATAREST-952 and commented
Spring Data REST paging starts the page number from zero and I've not found a way to change that. This is problematic for projects where paging exists without Spring Data (the API becomes inconsistent), or for business requirements that page number must start from 1. It'll be nice to have a property to determine the minimum page number that defaults to zero (so that existing users are not made unhappy). If the user provides a page number below the minimum page number configured, HTTP 400 should be returned
Affects: 2.5.5 (Hopper SR5)