i tried many ways to edit default pagination value in spring boot to start with index 1 not zero
My app contain spring-security-oauth2 , spring-data dependencies
1 - This Way Not worked
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
resolver.setOneIndexedParameters(true);
resolver.setFallbackPageable(new PageRequest(1, 20));
argumentResolvers.add(resolver);
super.addArgumentResolvers(argumentResolvers);
}
}
2- adding this property in application.yml not working
spring.data.web.pageable.one-indexed-parameters=true
i just need to start pagination from page=1
like this URL http://localhost:8080/api/v1/articles/page?page=1 [should return first page]
NOT THAT http://localhost:8080/api/v1/articles/page?page=0 [should return empty content]