PageRequest constructors have been deprecated

一世执手 提交于 2019-11-30 05:35:49
Veluria

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.

Feroz Mujawar

You can use the following solution to solve your problem:

Page<User> users=userService.findByUserType(id,PageRequest.of(1, 3));

We can use PageRequest.of(offset, limit) instead of new PageRequest(offset, limit). In this case we don't need to use deprecated constructor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!