PageRequest constructors are deprecated

I am working on a snapshot of Spring Data Commons v2 +, and I see that the constructors for PageRequest are deprecated. This apparently happened between M1 and M2 . Unfortunately, this is the only [real] implementation of the Pageable interface. I wonder where the effort is going, and what is the best alternative for the current development.

+5
source share
1 answer

These are just constructors that are out of date. Instead

 new PageRequest(firstResult, maxResults, new Sort(...)) 

now you can use

 PageRequest.of(firstResult, maxResults, new Sort(...)) 

and what is he.

+8
source

Source: https://habr.com/ru/post/1269370/


All Articles