In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Springfox-swagger is often used in Spring Boot projects to generate REST API documents and springfox-swagger-ui is used for API testing.
Io.springfox springfox-swagger2 2.8.0 io.springfox springfox-swagger-ui 2.8.0
When the parameters of the REST API method contain org.springframework.data.domain.Pageable, if there is no other configuration, Swagger generates parameters such as pageNumber, pageSize, offset, paged, unpaged, sort.sorted, sort.unsorted and so on according to the get/is method of the interface Pageable, but in fact these parameters are invalid.
ApiOperation (value = "Find airlines") @ GetMapping (value = "/ airlines") public Page searchAirlines (Airline airline, Pageable pageable) {return repository.findAll (org.springframework.data.domain.Example.of (airline), pageable);}
For the process of parsing Pageable parameters by Spring Boot, please see the resolveArgument () method of org.springframework.data.web.PageableHandlerMethodArgumentResolver:
@ Overridepublic Pageable resolveArgument (MethodParameter methodParameter, @ Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @ Nullable WebDataBinderFactory binderFactory) {assertPageableUniqueness (methodParameter); Optional defaultOrFallback = getDefaultFromAnnotationOrFallback (methodParameter). ToOptional (); String pageString = webRequest.getParameter (getParameterNameToUse (pageParameterName, methodParameter)); String pageSizeString = webRequest.getParameter (getParameterNameToUse (sizeParameterName, methodParameter)); Optional page = parseAndApplyBoundaries (pageString, Integer.MAX_VALUE, true); Optional pageSize = parseAndApplyBoundaries (pageSizeString, maxPageSize, false) If (! (page.isPresent () & & pageSize.isPresent ()) & &! defaultOrFallback.isPresent ()) {return Pageable.unpaged ();} int p = page.orElseGet (()-> defaultOrFallback.map (Pageable::getPageNumber) .orElseThrow (IllegalStateException::new)); int ps = pageSize.orElseGet ()-> defaultOrFallback.map (Pageable::getPageSize) .orElseThrow (IllegalStateException::new)); / / Limit lower bound ps = ps
< 1 ? defaultOrFallback.map(Pageable::getPageSize).orElseThrow(IllegalStateException::new) : ps; // Limit upper bound ps = ps >Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.