Spring Web MVC浅析

Spring Web MVC浅析

本文参考官方文档和《Spring技术内幕:深入解析spring架构与设计原理第2版》 计文柯

Context Hierarchy

Spring Web MVC浅析
上下文层次图

Bean Type Explanation
HandlerMapping Map a request to a handler along with a list of interceptors for pre- and post-processing. The mapping is based on some criteria, the details of which vary by HandlerMapping implementation. The two main HandlerMapping implementations are RequestMappingHandlerMapping (which supports @RequestMapping annotated methods) and SimpleUrlHandlerMapping (which maintains explicit registrations of URI path patterns to handlers).
HandlerAdapter Help the DispatcherServlet to invoke a handler mapped to a request, regardless of how the handler is actually invoked. For example, invoking an annotated controller requires resolving annotations. The main purpose of a HandlerAdapter is to shield the DispatcherServlet from such details.
HandlerExceptionResolver Strategy to resolve exceptions, possibly mapping them to handlers, to HTML error views, or other targets. See Exceptions.
HandlerMapping Resolve logical String-based view names returned from a handler to an actual View with which to render to the response. See View Resolution and View Technologies.
ViewResolver Resolve logical String-based view names returned from a handler to an actual View with which to render to the response. See View Resolution and View Technologies.
LocaleResolver, LocaleContextResolver Resolve the Locale a client is using and possibly their time zone, in order to be able to offer internationalized views. See Locale.
ThemeResolver Resolve themes your web application can use — for example, to offer personalized layouts. See Themes.
MultipartResolver Abstraction for parsing a multi-part request (for example, browser form file upload) with the help of some multipart parsing library. See Multipart Resolver.
FlashMapManager Store and retrieve the “input” and the “output” FlashMap that can be used to pass attributes from one request to another, usually across a redirect. See Flash Attributes.