标签:ica throw fail bee sys ati text mvc exce
FrameworkServlet是HttpServletBean的子类,实现了HttpServletBean 的 initServletBean 方法。
通过initServletBean()进行WebApplicationContext初始化,其源码为:
1 /** 2 * Overridden method of {@link HttpServletBean}, invoked after any bean properties 3 * have been set. Creates this servlet‘s WebApplicationContext. 4 */ 5 @Override 6 protected final void initServletBean() throws ServletException { 7 getServletContext().log("Initializing Spring FrameworkServlet ‘" + getServletName() + "‘"); 8 if (this.logger.isInfoEnabled()) { 9 this.logger.info("FrameworkServlet ‘" + getServletName() + "‘: initialization started"); 10 } 11 long startTime = System.currentTimeMillis(); 12 13 try { 14 this.webApplicationContext = initWebApplicationContext(); 15 initFrameworkServlet(); 16 } 17 catch (ServletException ex) { 18 this.logger.error("Context initialization failed", ex); 19 throw ex; 20 } 21 catch (RuntimeException ex) { 22 this.logger.error("Context initialization failed", ex); 23 throw ex; 24 } 25 26 if (this.logger.isInfoEnabled()) { 27 long elapsedTime = System.currentTimeMillis() - startTime; 28 this.logger.info("FrameworkServlet ‘" + getServletName() + "‘: initialization completed in " + 29 elapsedTime + " ms"); 30 } 31 }
其主要的功能就是调用initWebApplicationContext方法初始化一个WebApplicationContext。
以下是initWebApplicationContext的源码:
Spring MVC之FrameworkServlet源码分析
标签:ica throw fail bee sys ati text mvc exce
原文地址:https://www.cnblogs.com/smile_to_warm/p/8998987.html