Spring MVC消息转换流程
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod#invokeAndHandle
Object returnValue = invokeForRequest(webRequest, mavContainer, providedArgs);org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite#handleReturnValue
//如果使用了@RequestBody,返回的就是RequestResponseBodyMethodProcessor
HandlerMethodReturnValueHandler handler = selectHandler(returnValue, returnType);org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor#handleReturnValue
mavContainer.setRequestHandled(true);
ServletServerHttpRequest inputMessage = createInputMessage(webRequest);
ServletServerHttpResponse outputMessage = createOutputMessage(webRequest);
//执行消息转换
// Try even with null return value. ResponseBodyAdvice could get involved.
writeWithMessageConverters(returnValue, returnType, inputMessage, outputMessage);