1. 程式人生 > >springmvc controller相關注解原始碼位置

springmvc controller相關注解原始碼位置

流程大致是

dispatcherServlet => RequestMappingHandlerAdapter => invokeHandlerMethod=>ServletInvocableHandlerMethod

原始碼分析可以參考https://www.cnblogs.com/sunny3096/p/7215906.html

@RequestParam

位於RequestParamMethodArgumentResolver和RequestParamMapMethodArgumentResolver

@PathVariable

位於PathVariableMethodArgumentResolver和PathVariableMapMethodArgumentResolver

@MatrixVariable

位於MatrixVariableMethodArgumentResolver和MatrixVariableMapMethodArgumentResolver

@ModelAttribute

ServletModelAttributeMethodProcessor

@RequestBody @ResponseBody

RequestResponseBodyMethodProcessor

@RequestPart

RequestPartMethodArgumentResolver

@RequestHeader

RequestHeaderMethodArgumentResolver和RequestHeaderMapMethodArgumentResolver

@CookieValue

ServletCookieValueMethodArgumentResolver

@Value

ExpressionValueMethodArgumentResolver

@SessionAttribute

SessionAttributeMethodArgumentResolver

@RequestAttribute

RequestAttributeMethodArgumentResolver