in my Spring Boot Rest Service I want to implement a getAll method with pagination for lazy loading in frontend later.
At the moment I have to request with page 0 if I want the first set of rows. With the following config inserted in the application.properties it should work... spring.data.web.pageable.one-indexed-parameters=true ... but it doesn't.
Does anybody knows why or is this a legacy way? I'm using spring-boot-starter-web and data-jpa in version 2.0.4.RELEASE.
Thanks a lot!
edit, here is the service method, maybe PageRequest can't handle this.
public List<TransactionResponseDTO> findAll(int pageNumber, int pageSize) {
List<TransactionResponseDTO> transactionResponseDTOs = new ArrayList<>();
PageRequest pageRequest = PageRequest.of(pageNumber, pageSize);
List<TransactionEntity> transactionEntities =
transactionRepository.findAll(pageRequest).getContent();
for (TransactionEntity transactionEntity : transactionEntities) {
transactionResponseDTOs.add(convert(transactionEntity));
}
return transactionResponseDTOs;
}