本文整理汇总了Java中org.springframework.data.web.SortHandlerMethodArgumentResolver类的典型用法代码示例。如果您正苦于以下问题:Java SortHandlerMethodArgumentResolver类的具体用法?Java SortHandlerMethodArgumentResolver怎么用?Java SortHandlerMethodArgumentResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortHandlerMethodArgumentResolver类属于org.springframework.data.web包,在下文中一共展示了SortHandlerMethodArgumentResolver类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addArgumentResolvers
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的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: addArgumentResolvers
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的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);
}
示例3: addArgumentResolvers
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的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);
}
示例4: addArgumentResolvers
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的package包/类
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new SortHandlerMethodArgumentResolver());
}
示例5: sortResolver
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的package包/类
@Bean
public SortHandlerMethodArgumentResolver sortResolver() {
return new SortHandlerMethodArgumentResolver();
}
示例6: sortResolver
import org.springframework.data.web.SortHandlerMethodArgumentResolver; //导入依赖的package包/类
@Bean
public SortHandlerMethodArgumentResolver sortResolver() {
return new SortHandlerMethodArgumentResolver();
}