How to get all results in one page using Spring Data Pagination
The more correct way is to use Pageable.unpaged()
Pageable wholePage = Pageable.unpaged();
return customerRepository.findAll(wholePage);
Your page request is incorrect because you are looking for results on the wrong page. It should be:
PageRequest.of(0, Integer.MAX_VALUE);
The first page for results is 0. Since you're returning all records, they are all on this page.