I have a PagingandSorting Repository which has a method that accecpts a pageable object. I also have a controller that accepts a pageable object through the URL.
My
You can set below in application.yml
spring.data.rest.default-page-size: 50
In Spring Boot 2.1.6.RELEASE
, you can use below:
@Configuration
public class WebConfig implements WebMvcConfigurer{
@Value("${paging.default.pageSize}")
private int size;
@Value("${paging.default.page}")
private int page;
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
PageableHandlerMethodArgumentResolver resolver = new PageableHandlerMethodArgumentResolver();
resolver.setFallbackPageable(PageRequest.of(page, size));
resolvers.add(resolver);
WebMvcConfigurer.super.addArgumentResolvers(resolvers);
}
}