spring - mvc流程詳解

來源:魅力女性吧 2.98W
spring mvc流程詳解

1、首先創建父容器(AnnotationConfigWebApplicationContext),通過自定義的getRootConfigClasses()拿到配置類,並註冊到父容器中。

2、通過父容器作為參數創建ContextLoaderListener監聽器。並添加到servletContext(Tomcat servlet容器)。

3、通過自定的getServletConfigClasses()方法拿到MVC的配置類創建子容器,並把配置類註冊到子容器中。

4、創建DispatcherServlet,並將DispatcherServlet添加到servletContext的Servlet容器中去。

5、設置dispatcherServlet相關屬性(啟動時加載,設置映射路徑)。

熱門標籤