springcloud-community / springcloud-comment

0 stars 0 forks source link

post/2022-04/spring-boot-rest/ #24

Open utterances-bot opened 1 week ago

utterances-bot commented 1 week ago

Build a Spring Boot REST API with Pagination and Sorting - Spring Cloud

Learn how to build a Spring Boot REST API with paging and sorting capabilities using spring data jpa.

https://www.springcloud.io/post/2022-04/spring-boot-rest/

rapa2008 commented 1 week ago

There are two issues in this page.

  1. PageDTO pojo creation is missed in the steps. I had to refer the code from github to find it. To make the project complete, please add it in this page.
  2. The code gives error on plantRepository.saveAll(plants). After research I found that PagingAndSortingRepository interface doesn't have save() or saveAll() methods. So, we need to extend CrudRepository as well. Please update the page with public interface PlantRepository extends PagingAndSortingRepository<Plant, Long>, CrudRepository<Plant, Long> {} Thanks for the details. I could run the project after making the changes. It is really helpful.