What is the principle of HandlerMethodArgumentResolver?

as the title: in a controller request method, there are two custom parameter annotations @ UserInfo and @ SchoolInfo

@RequestMapping(value = "/filter/test2")
    public String test2(@RequestBody String o, @UserInfo UserInfoVo userInfoVo, @SchoolInfo SchoolInfoVo schoolInfoVo) {
        System.out.println("Controller:" + o);
        System.out.println("UserInfo:" + userInfoVo);
        System.out.println("SchoolInfo:" + schoolInfoVo);
        return "OK";
    }

implement the two parameter parsers as follows:

public class LoginUserInfoMethodArgumentResolver implements HandlerMethodArgumentResolver {
    @Override
    public boolean supportsParameter(MethodParameter parameter) {
//        return parameter.getParameterType().equals(UserInfoVo.class);
        System.out.println("login" + parameter.hasParameterAnnotation(UserInfo.class));
        return parameter.hasParameterAnnotation(UserInfo.class);
    }

    @Override
    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
        HttpServletRequest httpServletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
        String str = HttpHelper.getBodyString(httpServletRequest);
        System.out.println("login:" + str);
        UserInfoVo u = new UserInfoVo();
        u.setName("");
        u.setAge(233);
        return u;
    }
}
public class SchoolInfoMethodArgumentResolver implements HandlerMethodArgumentResolver {
    @Override
    public boolean supportsParameter(MethodParameter parameter) {
        System.out.println("school" + parameter.hasParameterAnnotation(SchoolInfo.class));
        return parameter.hasParameterAnnotation(SchoolInfo.class);
    }

    @Override
    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
        HttpServletRequest httpServletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
        String str = HttpHelper.getBodyString(httpServletRequest);
        System.out.println("school:" + str);
        SchoolInfoVo schoolInfoVo = new SchoolInfoVo();
        schoolInfoVo.setName("HNU");
        schoolInfoVo.setYear(1980);
        return schoolInfoVo;
    }
}
The order of implementation in

WebMvcConfigurerAdapter is as follows:

@Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        super.addArgumentResolvers(argumentResolvers);
        argumentResolvers.add(new LoginUserInfoMethodArgumentResolver());
        argumentResolvers.add(new SchoolInfoMethodArgumentResolver());
    }

final output

logintrue
loginfalse
schooltrue

if calculated according to the order in which list is added, the first scan determines that parameter.hasParameterAnnotation (UserInfo.class) is true, and the second scan parameter.hasParameterAnnotation (UserInfo.class) and parameter.hasParameterAnnotation (SchoolInfo.class) are flase and true, respectively. Why false is returned in the second parameter parser

Mar.12,2022

the first time is to send @ UserInfo UserInfoVo userInfoVo in, so it is true

.

the second time is to pass @ SchoolInfo SchoolInfoVo schoolInfoVo in, so it is false, and then traverses to SchoolInfoMethodArgumentResolver and returns true

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e62378-4dd2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e62378-4dd2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?