4

I am coding a Spring Boot system which connects to the database. While implementing functions that change the state of the entity, I faced the following problem:

'PageRequest(int, int, org.springframework.data.domain.Sort)' has protected access in 'org.springframework.data.domain.PageRequest'

in this:

@Override
public List<Picture> getAllPictures(int pageNumber, int pageSize) {
    return pictureRepository.findAll(new PageRequest(pageNumber, pageSize)).getContent();
}

How can I solve it? Is it something else that is similar to PageRequest and could replace it?

coder-coder
  • 323
  • 4
  • 13

1 Answers1

5

This piece of documentation will help you definitely..Look at the PageRequest.of()

Eugene Lesnov
  • 188
  • 1
  • 2
  • 13