本文整理匯總了Java中org.springframework.data.web.PageableHandlerMethodArgumentResolver.setPageParameterName方法的典型用法代碼示例。如果您正苦於以下問題:Java PageableHandlerMethodArgumentResolver.setPageParameterName方法的具體用法?Java PageableHandlerMethodArgumentResolver.setPageParameterName怎麽用?Java PageableHandlerMethodArgumentResolver.setPageParameterName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.data.web.PageableHandlerMethodArgumentResolver
的用法示例。
在下文中一共展示了PageableHandlerMethodArgumentResolver.setPageParameterName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addArgumentResolvers
import org.springframework.data.web.PageableHandlerMethodArgumentResolver; //導入方法依賴的package包/類
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
Sort defaultSort = new Sort(new Sort.Order(Sort.Direction.ASC, "id"));
Pageable defaultPage = new PageRequest(0, 10, defaultSort);
SortHandlerMethodArgumentResolver sortHandlerMethodArgumentResolver = new SortHandlerMethodArgumentResolver();
sortHandlerMethodArgumentResolver.setSortParameter("sort");
sortHandlerMethodArgumentResolver.setFallbackSort(defaultSort);
PageableHandlerMethodArgumentResolver pageableResolver = new PageableHandlerMethodArgumentResolver();
pageableResolver.setMaxPageSize(100);
pageableResolver.setOneIndexedParameters(false);
pageableResolver.setPageParameterName("page");
pageableResolver.setSizeParameterName("size");
pageableResolver.setFallbackPageable(defaultPage);
argumentResolvers.add(sortHandlerMethodArgumentResolver);
argumentResolvers.add(pageableResolver);
}
示例2: pageableResolver
import org.springframework.data.web.PageableHandlerMethodArgumentResolver; //導入方法依賴的package包/類
@Bean
public PageableHandlerMethodArgumentResolver pageableResolver() {
PageableHandlerMethodArgumentResolver pageableHandlerMethodArgumentResolver = new PageableHandlerMethodArgumentResolver(sortResolver());
pageableHandlerMethodArgumentResolver.setPageParameterName("page");
pageableHandlerMethodArgumentResolver.setOneIndexedParameters(true);
pageableHandlerMethodArgumentResolver.setSizeParameterName("limit");
return pageableHandlerMethodArgumentResolver;
}
示例3: addArgumentResolvers
import org.springframework.data.web.PageableHandlerMethodArgumentResolver; //導入方法依賴的package包/類
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
SortHandlerMethodArgumentResolver r1 = new SortHandlerMethodArgumentResolver();
r1.setSortParameter("model_query_pageable.pageSort");
PageableHandlerMethodArgumentResolver r2 = new PageableHandlerMethodArgumentResolver(r1);
r2.setPageParameterName("model_query_pageable.pageNumber");
r2.setSizeParameterName("model_query_pageable.pageSize");
argumentResolvers.add(r2);
}
示例4: addArgumentResolvers
import org.springframework.data.web.PageableHandlerMethodArgumentResolver; //導入方法依賴的package包/類
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
SortHandlerMethodArgumentResolver r1 = new SortHandlerMethodArgumentResolver();
r1.setSortParameter("model_query_pageable.sort");
PageableHandlerMethodArgumentResolver r2 = new PageableHandlerMethodArgumentResolver(r1);
r2.setPageParameterName("model_query_pageable.pageNumber");
r2.setSizeParameterName("model_query_pageable.pageSize");
argumentResolvers.add(r2);
}