'Sort(org.springframework.data.domain.Sort.Direction, java.util.List<java.lang.String>)' has private access in 'org.springframework.data.domain.Sort'

Springboot2.2.1以上的版本包括它的Sort已经不能实例化了即不能使用new来构造对象了。
可以选择使用Sort.by()方法来实例化:
Sort.by(Sort.Direction.DESC,"avgscore")
从Springboot 2.2.1版本开始,Sort类的构造方法变为私有,无法直接实例化。推荐使用Sort.by()方法来创建Sort对象,例如:Sort.by(Sort.Direction.DESC,avgscore)。这种方式更加符合Spring的数据访问层操作规范。
430

被折叠的 条评论
为什么被折叠?



