I\'m working the Spring Data Commons v2+ snapshot, and I see that the constructors for a PageRequest
have been deprecated. This appears to have occurred betwee
We can use PageRequest.of(offset, limit)
instead of new PageRequest(offset, limit)
.
In this case we don't need to use deprecated constructor.
It's just the constructors which have been deprecated. Instead of
new PageRequest(firstResult, maxResults, new Sort(...))
you can now use
PageRequest.of(firstResult, maxResults, Sort.by(...))
and that's it.
You can use the following solution to solve your problem:
Page<User> users=userService.findByUserType(id,PageRequest.of(1, 3));