→ 방법은 페이징 처리를 진행하면된다!!

방법1. Pageable

public List<BoardResponse> getList(int page) {
        PageRequest pageRequest = PageRequest.of(page, 5);
        return boardRepository.findAll(pageRequest).stream()
                .map(BoardResponse::new)
                .collect(Collectors.toList());

    }
 @DisplayName("글 1페이지 조회")
    @Test
    void test() {
        //given
        List<Board> requestBoards = IntStream.range(0, 30)
                .mapToObj(i ->
                    Board.builder()
                            .title("예제 제목 - " + i)
                            .content("치킨 - " + i)
                            .build()
                ).toList();
        boardRepository.saveAll(requestBoards);

        List<BoardResponse> boardResponses = tistoryService.getList(1);

        assertThat(boardResponses).hasSize(5);
        //when

        //then
    }
  data:
    web:
      pageable:
        one-indexed-parameters: true

정렬 방법

  PageRequest pageRequest = PageRequest.of(page, 5, Sort.by(Sort.Direction.DESC,"id"));