@Repository
public interface UserRepository extends JpaRepository<User,Long> {
List<User> findByName(String name, Pageable pageable);
}
@GetMapping("/name/pageable")
public List<UserApiResponse> pageableTest(@RequestParam String name,@PageableDefault(sort = "id",size = 10,direction = Sort.Direction.DESC) Pageable pageable){
return userService.pageableTest(name,pageable);
}
@PageableDefault annotation을 통해 page의 sort,size등을 지정할 수 있다.