Getting Started 20 - Spring MVC Frame Class Diagram and Sequence Diagram
With the understanding of the Spring's framework, we can understand how the classes and interfaces work together with each other. Directly to see several core categories and interfaces, listed in the picture below the interface we often use. Realize the specifically:
Spring MVC
The center of the frame is DispatcherServlet, which can be seen around the DispatcherServlet in the figure. For the category of its dependent, DispatcherServlet does not directly depend on the specific implementation, but depending on the interface. DispatcherServlet The uppermost parent category is httpservlet, which is HTTPSERVLETBEAN and FRAMEWORKSERVLET, HTTPSERVLETBEAN Processing bean settings, FrameworkServlet Adds Context-related feature. In addition to the respective responsible functions, we can see from the sequential diagram. When the Container is called the parent category, the httpservletBean's initservletBean () method starts, using the Template Method mode to perform subclasses Initial action:
FrameworkServlet
WebApplicationContext will be established, then use the factory method call subscriber's initframeworkServlet (), in the subclass, a series of checks are performed to see if the relevant ViewResolver is set, which is the IOC container dependent injection of Spring. Function, we can complete these related ViewResolver et al. The following sequence diagram is a workflow for Spring MVC:
For GET or POST methods, we handed over DOSERVICE (), and can roughly you can learn about the workflow from the previous example. Basically these pictures are simplified, if you are interested in understanding , You can take a look at the program code in the DispatcherServlet.