spring-projects/spring-data-commons

EnableSpringDataWebSupport causes paging to ignore properties

Opened this issue · 0 comments

Spring Boot : 3.4.6
Spring Data Commons : 3.4.6

When @EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO) is used as described in https://docs.spring.io/spring-data/commons/reference/repositories/core-extensions.html#core.web.pageables

The properties defined under spring.data.web.pageable are ignored. e.g. max-page-size

Workaround :

... Configuration class implementing PageableHandlerMethodArgumentResolverCustomizer

/*
Workaround
A PageableHandlerMethodArgumentResolver bean is instantiated by SpringDataWebConfiguration. As a result
SpringDataWebAutoConfiguration cannot call pageableCustomizer to load the properties defined in SpringDataWebProperties.
*/
@OverRide
public void customize(PageableHandlerMethodArgumentResolver pageableResolver) {
pageableResolver.setMaxPageSize(5000);
pageableResolver.setFallbackPageable(Pageable.unpaged());
}