Several common extensibility points provided by spring MVC

Source: Internet
Author: User


Spring3 MVC simple structure, the sentence should be simple is the United States, and he is strong 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 the filter, Spring MVC is a servlet , but Spring MVC It 's very simple, whether it's learning or using.

This is the core flowchart of Spring3 MVC:





Spirngmvc The first extension point

handlermapping Interface -- mapping of processing requests

Save Request URL to the specific method of the mapping relationship, , we can write arbitrary handlermapping implementation class, based on any policy to determine a Web Request to Handlerexecutionchain the generation of the object.


Spirngmvc The second extension point

Handlerinterceptor Interface -- Interceptor

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


Spirngmvc The third extension point

      handleradapter interface   –   processing adapter

        really calls Controller handleradapter You can provide your own implementation class to handle handler object.


Spirngmvc The fourth extension point

handlermethodargumentresolver-- processing Method parameter Interpretation Binder

Before invoking the Controller method, the method parameter is interpreted to bind (implement Webargumentresolver interface, spring3.1 recommend using handlermethodargumentresolver later);


Spirngmvc The fifth extension point

Converter--type converter

Parameter binding Springmvc automatically converts the parameters from the front end to the type of the parameter defined by the method, and we can define this interface ourselves to implement our own type of conversion


Spirngmvc Sixth extension Point

    viewresolver interface   –   View parser

to complete the process from Modelandview to the real view, the Viewresolver interface is called in Dispatcherservlet, When Dispatcherservlet invokes the controller, it gets a Modelandview object, and Dispatcherservlet calls the Render method to render the view.

Springmvc The seventh extension point provided:

Handlerexceptionresolver interface--Exception handling



Several common extensibility points provided by spring MVC

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.