本文整理汇总了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);
}