springMVC initialization process vessel and spring

spring initialization process:
entry point is

<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Creating this container into the ServletContext listener, key is the fully qualified class name of .ROOT ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE =

The process of creating container: first see if there is a custom container class is not specified in web.xml, any reflection created by Class.forname not to use the default container class WebXmlApplicationContext

springMVC initialization process:
the DispatcherServlet template with a lot of design patterns springMVC use the strategy pattern to accomplish many functions
first from the ServletContext to get done by ContextLoaderListener initialized and put into the root container object reference that is required to get the parent container vessel last spring also created XmlWebApplicationContext container
policy Related mode:
initMultipartResolver used to process file uploads
initLocaleResolver for processing international
initHandlerAdapters mapping process
initHandlerExceptionResolvers exception processing
initRequestToViewNameTranslator a conversion processing request to view names
initViewResolvers process view

In general:
DispatcherServlet inherited httpservletBean and FrameworkServlet
httpservletBean create a configuration or resource files - "frameWorkServlet create an association springMVC spring container and container -" only for initialization specific function in the DispatcherServlet

Published 63 original articles · won praise 44 · views 6233

Guess you like

Origin blog.csdn.net/weixin_40695328/article/details/104028099