Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring boot pageable configure params name

I am using Spring Boot v1.5.2.RELEASE.

My controller is like this:

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

My parameters size:10 page:0, Pageable works fine.

But now I want to change my parameters to pageSize:10 currentPage:0.

Pageable doesn't work, because pageable can only receive size and page, and doesn't support other parameter names.

How can I configure this to use pageSize and currentPage instead of size and page?

like image 229
Martin Avatar asked Sep 17 '25 14:09

Martin


1 Answers

You can also use spring's application properties like this

spring.data.web.pageable.page-parameter: pageNumber
spring.data.web.pageable.size-parameter: pageSize

You can learn about other common application properties here.

like image 176
theprogrammer Avatar answered Sep 20 '25 06:09

theprogrammer