Skip to content

Commit ad854bc

Browse files
committed
spring-projects#174 - Applied default sorting to controller in Querydsl web sample.
1 parent 84bfe86 commit ad854bc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎web/querydsl/src/main/java/example/users/web/UserController.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.beans.factory.annotation.Autowired;
2323
import org.springframework.data.domain.Pageable;
2424
import org.springframework.data.querydsl.binding.QuerydslPredicate;
25+
import org.springframework.data.web.PageableDefault;
2526
import org.springframework.stereotype.Controller;
2627
import org.springframework.ui.Model;
2728
import org.springframework.util.MultiValueMap;
@@ -46,7 +47,8 @@ class UserController {
4647

4748
@RequestMapping(value = "/", method = RequestMethod.GET)
4849
String index(Model model, //
49-
@QuerydslPredicate(root = User.class) Predicate predicate, Pageable pageable, //
50+
@QuerydslPredicate(root = User.class) Predicate predicate, //
51+
@PageableDefault(sort = { "lastname", "firstname" }) Pageable pageable, //
5052
@RequestParam MultiValueMap<String, String> parameters) {
5153

5254
ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentRequest();

0 commit comments

Comments
 (0)