Use PageRequest.of(..) and Sort.by(..)
ProprietarySpring Data 2.0 deprecated the constructors of PageRequest and Sort, and new Sort.Order(property), in favor of static factory methods, and they are no longer accessible as of Spring Data 2.2. new Sort(direction, list) has no factory method that takes a List, so its properties become an array. A Sort or Sort.Direction that is null at runtime is left for the application to handle: the constructors accepted them on Spring Data 1.x, and the factory methods reject them by 2.7. Subclasses keep their constructors, constructor references such as Sort.Order::new are left for the compiler to point out, and only Java sources are migrated.
io. moderne. java. spring. data. MigratePageRequestAndSortmod run . --recipe= io. moderne. java. spring. data. MigratePageRequestAndSortInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.