The constructor Sort(Sort.Direction, String) is undefined

99封情书 提交于 2020-01-16 08:46:31

问题


I want to use Spring Data JPA with default sort direction with the latest spring-boot-starter-parent 2.2.1.RELEASE:

@Override
public Page<ProcessingLogs> findAll(int page, int size) {
    return dao.findAll(PageRequest.of(page,size, new Sort(Sort.Direction.DESC, "createdAt")));
}

But I get error:

The constructor Sort(Sort.Direction, String) is undefined

This is the latest code: https://github.com/spring-projects/spring-data-commons/blob/master/src/main/java/org/springframework/data/domain/Sort.java

Do you know how I can solve this issue?


回答1:


Use like this PageRequest.of(page, size, Sort.by(Sort.Direction.DESC,"createdAt"))



来源:https://stackoverflow.com/questions/59060633/the-constructor-sortsort-direction-string-is-undefined

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