Spring Boot可分页配置参数名称

Mar*_*tin 4 spring spring-mvc

我正在使用 Spring Boot v1.5.2.RELEASE。

我的控制器是这样的:

@PostMapping(path = "/list_praxis")
public
@ResponseBody
ModelAndView login(Pageable pageable,HttpServletRequest request) {
    return new ModelAndView(new WebJsonView());
}
Run Code Online (Sandbox Code Playgroud)

我的参数size:10 page:0,Pageable 工作正常。

但现在我想将我的参数更改为 pageSize:10 currentPage:0.

pageable 不起作用,因为 pageable 只能接收sizepage,并且不支持其他参数名称。

我如何配置它以使用pageSizeandcurrentPage而不是sizeand page

the*_*mer 7

您还可以像这样使用 spring 的应用程序属性

spring.data.web.pageable.page-parameter: pageNumber
spring.data.web.pageable.size-parameter: pageSize
Run Code Online (Sandbox Code Playgroud)

您可以在此处了解其他常见应用程序属性。