package com.cubetiqs.demo.rest; import com.cubetiqs.demo.domain.PostEntity; import com.cubetiqs.demo.service.PostService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping(path = {"/posts"}) public class PostController { private final PostService postService; @Autowired public PostController(PostService postService) { this.postService = postService; } @GetMapping public List getAllPosts(Pageable pageable) { return postService.findAll(); } }