Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用springboot rest的自定义响应_Rest_Spring Mvc_Spring Boot - Fatal编程技术网

使用springboot rest的自定义响应

使用springboot rest的自定义响应,rest,spring-mvc,spring-boot,Rest,Spring Mvc,Spring Boot,我正在使用springboot 2.0.0开发RestAPI。我想定制所有RestAPI调用的响应 API URL:结果是 { "content":[ { "id":10, "name":"raj", }, ], "pageable":{ "sort":{ "sorted":false, "unsorted":true }, "offset":0,

我正在使用springboot 2.0.0开发RestAPI。我想定制所有RestAPI调用的响应

API URL:结果是

{
   "content":[
      {
         "id":10,
         "name":"raj",
      },
   ],
   "pageable":{
      "sort":{
         "sorted":false,
         "unsorted":true
      },
      "offset":0,
      "pageSize":10,
      "pageNumber":0,
      "paged":true,
      "unpaged":false
   },
   "last":true,
   "totalPages":1,
   "totalElements":1,
   "size":10,
   "number":0,
   "numberOfElements":1,
   "first":true,
   "sort":{
      "sorted":false,
      "unsorted":true
   }
}
我想定制的是,JSON密钥内容必须替换为RestAPI相对路径的最后一部分。在本例中,内容替换为联系人,以及如何定制可分页json作为响应


我返回org.springframework.data.domain.Pageable

这取决于自定义实体中字段的排列。

无法得到您的答案,让我解释一下我在做什么以及我需要Controller@GetMapping ResponseEntity做什么