使用springboot rest的自定义响应
我正在使用springboot 2.0.0开发RestAPI。我想定制所有RestAPI调用的响应 API URL:结果是使用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,
{
"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做什么