/**
* It has the functions of paging and sorting and inherits CrudRepository
*/
public interface UserPageRepository extends PagingAndSortingRepository
}
1
2
3
4
5
UserPageRepositoryTests:
@RunWith(SpringRunner.class)
@SpringBootTest
public class UserPageRepositoryTests {
@Autowired
private UserPageRepository userPageRepository;
/**
* Sort query
*/
@Test
public void findAllBySort () {
List
System.out.println(userList.size( ));
System.out.println(userList);
}
/**
* Paging query
*/
@Test
public void findAllByPageable() {
Page
userPage.getNumber();//Number of pages
userPage.getContent();// Pagination data
userPage.getTotalPages();//Total number of pages
System.out.println(“number:” + userPage.getNumber(http://www.amjmh.com/v/BIBRGZ_558768/ )
+ “Countet” + userPage.getContent().size()
+ “TotalPages” + userPage.getTotalPages());
}
}