Several common extension points provided by spring MVC

Source: Internet
Author: User


SPRING3 MVC structure is simple, should the sentence simple is beautiful, and he is powerful and flexible, easy to expand, performance is also excellent. He's got the same idea as Struts2. There is a front-end interceptor for request forwarding, except that Struts2 is filter,spring MVC is a servlet, but spring MVC is very simple either learning or using.

This is the core flowchart of Spring3 MVC:





Spirngmvc the first extension point

Handlermapping interface--mapping for processing requests

To save the mapping relationship between the request URL and the specific method, we can write any handlermapping implementation class that determines the generation of a Web request to a Handlerexecutionchain object based on any policy.


Spirngmvc the second extension point

Handlerinterceptor Connector--Interceptor

Handlerinterceptor, by customizing the Interceptor, we can do whatever we want after a request is actually processed, the request is processed but not yet output to the response, and the request has been output to the response three points.

Spirngmvc the third extension point

Handleradapter Interface – Processing adapters

The real call controller place, in fact, is suitable for all kinds of controller. Handleradapter is that you can provide your own implementation class to handle handler objects.


Spirngmvc the fourth extension point

Handlermethodargumentresolver--processing method parameter interpreter binding device

Before calling the Controller method, the method parameters are interpreted binding (implement the Webargumentresolver interface, spring3.1 recommended to use handlermethodargumentresolver later);


Spirngmvc the fifth extension point

Converter--type converter

Parameter Binding timing SPRINGMVC will automatically convert the parameters from the front to the type of the parameter defined by the method, and we can define this interface ourselves to implement our own type of conversion.


The sixth extension point of the Spirngmvc

Viewresolver Interface – View parser

completes the process from Modelandview to the real view, the Viewresolver interface is invoked in Dispatcherservlet, When Dispatcherservlet calls the controller, a Modelandview object is obtained, and Dispatcherservlet calls the Render method for view rendering.

Springmvc the seventh extension point provided:

Handlerexceptionresolver interface--Exception handling



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.