Reputation: 1552
I need to change the max page size for an specific mapping but the only way I know to do this is changing the spring.data.web/rest.max-page-size
on the properties file.
But I need to change it only for an specific endpoint without affecting others.
Is there anyway to override this parameter?
Upvotes: 5
Views: 2343
Reputation: 351
for me (using spring boot version- 2.5.8) this worked-
spring.data.rest.max-page-size=2147483647
not spring.data.web.max-page-size
Upvotes: -1
Reputation: 451
One workaround would be to override Pageable object. Its pageSize property can't be overwritten but its possible to construct new object like this
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Pageable ovrPageable = PageRequest.of(pageable.getPageNumber(), MAX_PAGE_SIZE, pageable.getSort());
and then use ovrPageable instead of pageable.
Upvotes: 0
Reputation: 116
This answer helps me
You need to delete spring.data.web/rest.max-page-size
property and use @PageableLimits
with params in endpoints
Upvotes: 3