[英]How can I use Pageable in @RestController?
我知道Pageable
来自spring-data-
domain。
有没有优雅的方法直接在@RestController
使用org.springframework.data.domain.Pageable
?
我试过跟随。
@RequestMapping(method = RequestMethod.GET,
path = "pageable",
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Pageable> readPageable(@NotNull final Pageable pageable) {
return ResponseEntity.ok(pageable);
}
结果不是我的预期。
...: ~ $ curl -X GET --header 'Accept: application/json' 'http://localhost:8080/.../pageable?limit=1&offset=1' | python -mjson.tool
...
{
"offset": 0,
"pageNumber": 0,
"pageSize": 20,
"sort": null
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.