Undertake relevant previous SpringMVC Process analysis of framework technology
Initialization flow (initStrategies)
Execute the process
Find relevant HandlerMapping
Ask to DispatcherServlet Class to perform related HandlerMapping aggregate , Find the corresponding type of HandlerMapping Object implementation class , If it is general, use notes (@RequestMapping) Injected implementation class (RequestMappingHandlerMapping) class ,
HandlerMapping Implementation class RequestMappingHandlerMapping object
find Spring In the container @Controller/@RestController annotated bean And being @RequestMapping Annotated classes and methods .
HandlerMapping Attribute HandlerMethod object
HandlerMethod yes Method as well as Parameter Of helper class. stay HandlerMapping Constructed in ,
And in HandlerAdapter Is used in .
HandlerExecutionChain object
When the corresponding HandlerMapping After the implementation class of the object , Next, return to DispatcherServlet Class object , Need to build or get relevant HandlerExecutionChain object , There are many additional components inside , for example :interceptor Interceptor .
HandlerAdapter object
according to HandlerExecutionChain Medium Handler, In the corresponding HandlerAdapter Collection found support for this Handler Of HandlerAdapter, Call related HandlerMethod Object methods , Use HandlerAdapter obtain ModelAndView Object returns to DispatcherServlet.
RequestMappingHandlerAdapter
Find the corresponding RequestMapping Of HandlerAdapter Object implementation class RequestMappingHandlerAdapter Object operation processing .
HandlerInterceptor Interceptor
- Front interceptor :HandlerInterceptor-preHandle
- Post blocker :HandlerInterceptor-postHandle
HandlerExceptionResolver exception handling
Exceptions may occur in the above operation processing methods , Use HandlerExceptionResolver Strategy solution .
RequestMappingHandlerAdapter Processing operation of
- HandlerMethodArgumentResolverComposite: The object handles and contains multiple internal HandlerMethodArgumentResolver aggregate .
- HandlerMethodArgumentResolver: Parsing mechanism for parsing related method entry parameters !
- HandlerMethodReturnValueHandlerComposite: The object handles and contains multiple internal HandlerMethodReturnValueHandler aggregate .
- HandlerMethodReturnValueHandler: The object handles and operates on the return value of the method
HandlerMethodArgumentResolver Parser for parameter entry
RequestParamMethodArgumentResolver
Handle @RequestParam The parameter modified by the annotation :HandlerMethodArgumentResolver One of the implementation classes of :RequestParamMethodArgumentResolver.
RequestResponseBodyMethodProcessor
Handle @RequestBody The parameter modified by the annotation :HandlerMethodArgumentResolver Implementation class of
HandlerMethodReturnValueHandler Parameter returns the operation parser
RequestResponseBodyMethodProcessor
Handle @ResponseBody Annotation decorated return value :HandlerMethodReturnValueHandler Implementation class of
ModelAndViewMethodReturnValueHandler
The processing return value type is ModelAndView Object return value :HandlerMethodReturnValueHandler Implementation class of
ViewResolver view resolver
take ModelAndView Analyze and process the object data and data page template ViewResolver object , Generate relevant View object . And return the relevant response:freemarker, jsp. json, xml etc. .
HandlerInterceptor Close the deal
Finally complete the interceptor :afterCompletion Method of operation .
【Spring project 】「 Principle series 」SpringMVC How it works ( Supplement and revise ) More articles about
- Feign series (03)Feign working principle
Catalog Feign series (03)Feign working principle 1. Feign How it was designed 2. Feign A dynamic proxy 2.1 ReflectiveFeign structure 2.2 Generate proxy objects 2.3 Method ...
- SpringMVC How frame works
Study SpringMVC How it works , First of all, there are three problems to be solved : (1)DispathcherServlet How the framework intercepts specific HTTP request , Leave it to SpringMVC Handle ? (2) be located Web Layer of Spring Containers ...
- Talking about C++ Compiler principle ------ C++ How compilers and linkers work
original text :https://blog.csdn.net/zyh821351004/article/details/46425823 Chapter one : The first is precompiling , This step can be roughly considered to have done only one thing , It would be ...
- Android A journey in reverse --- Blow up an information application 「 The most right 」 Principle analysis of anti packet capture strategy
One . Reverse analysis First of all, thank you for the samples provided by Mr. Wang , Because classmate Wang came to me that day and asked me about an application Fiddler Failed to grab the bag , In fact, for such problems , I usually answer that : First, whether you install Fiddler Certificate , He said he installed . Second, do you ...
- 「 Block series 」「 Luogu P4168 [Violet]」 The dandelion Problem solving report
The dandelion Description We regard all dandelions as one with a length of \(n\) Sequence (\(a_1,a_2,...a_n\)), among \(a_i\) Is a positive integer , It means the first one i The number of the species of dandelion . Ask one area at a time ...
- redis Principle series -- Implementation principle of string storage (1)
background redis Powerful , Almost has become a modern large and medium-sized services necessary cache technology . In addition to the awesome cache function ,redis As a message queue , Database also has a good performance . We all know ,redis There are five types of data ,string, ...
- Linux Little knowledge translation - 「 framework To continue 」(arch)
The last time , from 「 The internal structure of a computer 」 Explains the term architecture from the perspective of . This time, , Let's introduce what is often mentioned in the architecture 「i386 framework 」 And later 「i486」,「i586」. install Linux When , Many people often hear it even if they don't understand it i386 framework ...
- 「 It is suggested to be careful 」 Come as soon as you want 15 A multi-threaded interview question is cool to the end at one time (1.1w Put your words in order )
. This article is for **「 Recommended collection 」200MB Interview documents of large factory , Sort out the summary 2020 The best interview question bank in 「CoreJava piece 」** Write the answer , All relevant articles have been included in the code cloud warehouse :https://gitee.com/bingqil ...
- 49、Spark Streaming How it works
One . Introduction to big data real-time computing 1. summary Spark Streaming, It's kind of Spark Provided , For big data , A framework for real-time computing . The bottom of it , Actually , Also based on what we explained before Spark Core Of . basic ...
- U How the disc works ( turn )
u How the disc works One . U The basic working principle of the disc Universal serial bus (Universal serial Bus) It is a fast and flexible interface , When one USB When the device is inserted into the host , because USB The reason of the device hardware itself , It will make USB Bus data signal ...
Random recommendation
- .Net in DLL Conflict resolution ( True and false Monkey King )
< Journey to the west > It's hard to tell the real monkey king from the fake Monkey King , But we are familiar with the details, and it is not difficult to separate them from each other . Those who don't care much about the problem can be directly transferred to the article about .Net Introduction of file version problem Recently compiling AKKA.net ...
- 【 original 】 Data mining cases ——ReliefF and K-means Medical application of algorithm
The proposal of data mining method , Let people have the ability to finally understand the real value of data , That is, the information and knowledge contained in the data . data mining (DataMiriing), It refers to extracting knowledge of interest from a large database or data warehouse , This knowledge is implicit . Unknown in advance ...
- Win7 Build... In the environment Go development environment , be based on VSCode Editor
One . Refer to the following articles when building http://www.cnblogs.com/zsy/archive/2016/02/28/5223957.html http://blog.csdn.net/hil20 ...
- About DataTable Two basic articles
DataTable Sometimes it's useful . Record two good articles , Be a dictionary 1.http://blog.csdn.net/imagse/article/details/3085870 2.https://ms ...
- neutron Disable... When creating subnets in dhcp Service issues
stay neutron Created in provider When the network , You can specify whether to disable dhcp. If disabled , You can use... In the physical network dhcp service . If using a physical network dhcp, You need to disable the... Provided in the subnet . Pictured
- In simple terms Smarty How the template engine works ( Two )
Source code download address : In simple terms Smarty How the template engine works Next, according to the following Smarty Template engine principle flow chart develop a template engine for learning , In order to deepen the understanding of . Smarty How the template engine works , It's actually a process : ...
- Object-C - The definition of a class
http://www.cnblogs.com/zhangweia/archive/2011/11/01/2231549.html 1. The documents are divided into .h: Defining interfaces , And its properties , Method statement . .m : It's the implementation class . ...
- Winter vacation ACM Training ( Two )
The efficiency is obviously low after the holiday , I've been studying recently Ubuntu, So wait until today to write . Still using PC. Really depressed, this LC-Display, In fact, there are many ideas . But I ended up thinking of him as 8 word , Divided into seven . always W ...
- Beanstalkd(ubuntu install )
install Beanstalkd # apt-get install beanstalkd Unubtu Turn on beanstalkd Persistence options for #vim /etc/default/beanstalkd hold S ...
- use Dart Development Android application (sky application )
This article uses the elegant Markdown And books Corrupt Google company , In order to solve Android Caton problem , A lot of determination has been made to this end , This is not the latest development Sky Mobile application UI frame , In the user interface and high quality UI Interaction design , It's amazing ...