I am new to Spring Data and Spring MVC, and I don't understand why I am getting empty content:
@RequestMapping(value="/pages", method=RequestMethod.GET) @ResponseBody public Page<Client> contactsPages(@RequestParam int page, @RequestParam int size) { Pageable pageable = new PageRequest(page, size, new Sort("id")); Page<Client> pageResult = clientRepository.findAll(pageable); return pageResult; }
The result of my json when testing the url:
{"content":[],"last":true,"totalElements":2,"totalPages":1,"size":5,"number":1,"sort":[{"direction":"ASC","property":"id","ignoreCase":false,"nullHandling":"NATIVE","ascending":true}],"first":false,"numberOfElements":0}
And if you have a good example doing a page request using Spring Data and Spring MVC and AngularJS; This will be a big help for me.
source share