Frameworkservlet is a subclass of Httpservletbean, which implements the Initservletbean method of Httpservletbean.
Through Initservletbean () for Webapplicationcontext initialization, the source code is:
1 /**2 * Overridden method of {@linkHttpservletbean}, invoked after any bean properties3 * have been set. Creates this servlet ' s webapplicationcontext.4 */5 @Override6 protected Final voidInitservletbean ()throwsservletexception {7Getservletcontext (). log ("Initializing Spring frameworkservlet" + getservletname () + "'");8 if( This. logger.isinfoenabled ()) {9 This. Logger.info ("Frameworkservlet" + getservletname () + "': Initialization Started");Ten } One LongStartTime =System.currenttimemillis (); A - Try { - This. Webapplicationcontext =Initwebapplicationcontext (); the Initframeworkservlet (); - } - Catch(Servletexception ex) { - This. Logger.error ("Context initialization Failed", ex); + Throwex; - } + Catch(RuntimeException ex) { A This. Logger.error ("Context initialization Failed", ex); at Throwex; - } - - if( This. logger.isinfoenabled ()) { - LongElapsedTime = System.currenttimemillis ()-StartTime; - This. Logger.info ("Frameworkservlet" + getservletname () + "': Initialization completed in" + inElapsedTime + "MS"); - } to}
Its main function is to call the Initwebapplicationcontext method to initialize a webapplicationcontext.
The following is the source code of Initwebapplicationcontext:
Spring MVC's Frameworkservlet source analysis