spring 技术内幕阅读笔记 - spring mvc

 

IoC 容器在Spring MVC 中的启动

  •     web容器中的上下文

    经过监听器ContextLoaderListener  contextInitialized()  web

    ContextLoader 初始化 WebApplicationContextspring

    WebApplicationContext 默认实现类是 XmlWebApplicationContextmvc

    XmlWebApplicationContext 初始化过程当中 IoC容器被创建app

    XmlWebApplicationContext  绑定到 ServletContextspa

  •     ContextLoader 创建根上下文

    ContextLoader 是spring 应用程序在web容器中的启动器对象

    

    实现了  ServletContextListener 的contextInitialized 接口,绑定容器生命周期初始化阶段接口

Spring MVC的启动

    DispatcherServlet 启动入口程序?生命周期

   

    HttpServletBean init 方法get

   

Spring MVC对HTTP请求的分发处理

  •     mvc初始化

      实现 GenericServlet init it

  •     HandlerMapping配置

    每一个请求对应一个 HandlerMapping

    HandlerMapping getHandler() 得到 HandlerExecutionChain 封装了具体的Controller对象

    

    也包括链接器链 为handler作加强服务,并提供相应方法

     

    使用HandlerMapping完成请求的映射处理

    AbstractHandlerMapping getHandler() 

    DispatcherServlet  doService--> doDispatch --> getHandler 处理结果交给视图层

    

    

Spring MVC 视图的呈现

    DispatcherServlet render resolveViewName 解析视图

相关文章
相关标签/搜索