|
19 | 19 |
|
20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 21 | import org.springframework.boot.CommandLineRunner; |
22 | | -import org.springframework.data.domain.Page; |
23 | | -import org.springframework.data.domain.PageRequest; |
24 | | -import org.springframework.data.domain.Slice; |
25 | 22 | import org.springframework.stereotype.Component; |
26 | 23 |
|
27 | 24 | /** |
@@ -65,50 +62,18 @@ public void run(String... args) throws Exception { |
65 | 62 |
|
66 | 63 | repository.saveAll(List.of(luke, leia, han, chewbacca, yoda, vader, kylo)); |
67 | 64 |
|
68 | | - System.out.println("------- annotated multi -------"); |
69 | | - System.out.println(repository.usersWithUsernamesStartingWith("l")); |
| 65 | + repository.usersWithUsernamesStartingWith("l"); |
70 | 66 |
|
71 | | - System.out.println("------- derived single -------"); |
72 | | - System.out.println(repository.findUserByUsername("yoda")); |
| 67 | + repository.findUserByUsername("yoda"); |
73 | 68 |
|
74 | | - System.out.println("------- derived nested.path -------"); |
75 | | - System.out.println(repository.findUserByPostsMessageLike("father")); |
| 69 | + repository.findUserByPostsMessageLike("father"); |
76 | 70 |
|
77 | | - System.out.println("------- derived optional -------"); |
78 | | - System.out.println(repository.findOptionalUserByUsername("yoda")); |
| 71 | + repository.findOptionalUserByUsername("yoda"); |
79 | 72 |
|
80 | | - System.out.println("------- derived count -------"); |
81 | 73 | Long count = repository.countUsersByLastnameLike("Sky"); |
82 | | - System.out.println("user count " + count); |
83 | 74 |
|
84 | | - System.out.println("------- derived exists -------"); |
85 | 75 | Boolean exists = repository.existsByUsername("vader"); |
86 | | - System.out.println("user exists " + exists); |
| 76 | + repository.findUserByLastnameLike("Sky"); |
87 | 77 |
|
88 | | - System.out.println("------- derived multi -------"); |
89 | | - System.out.println(repository.findUserByLastnameLike("Sky")); |
90 | | - |
91 | | - System.out.println("------- derived sorted -------"); |
92 | | - System.out.println(repository.findUserByLastnameLikeOrderByFirstname("Sky")); |
93 | | - |
94 | | - System.out.println("------- derived page -------"); |
95 | | - Page<UserProjection> page0 = repository.findUserByLastnameStartingWith("S", PageRequest.of(0, 2)); |
96 | | - System.out.println("page0: " + page0); |
97 | | - System.out.println("page0.content: " + page0.getContent()); |
98 | | - |
99 | | - Page<UserProjection> page1 = repository.findUserByLastnameStartingWith("S", PageRequest.of(1, 2)); |
100 | | - System.out.println("page1: " + page1); |
101 | | - System.out.println("page1.content: " + page1.getContent()); |
102 | | - |
103 | | - System.out.println("------- derived slice -------"); |
104 | | - Slice<User> slice0 = repository.findUserByUsernameAfter("luke", PageRequest.of(0, 2)); |
105 | | - System.out.println("slice0: " + slice0); |
106 | | - System.out.println("slice0.content: " + slice0.getContent()); |
107 | | - |
108 | | - System.out.println("------- derived top -------"); |
109 | | - System.out.println(repository.findTop2UsersByLastnameLike("S")); |
110 | | - |
111 | | - System.out.println("------- derived with fields -------"); |
112 | | - System.out.println(repository.findJustUsernameBy()); |
113 | 78 | } |
114 | 79 | } |
0 commit comments