1. What is the interceptor?
Spring MVC The interceptor (Interceptor) similar to the filter (Filter) Servlet is, it is mainly for intercepting a user request and processed accordingly. For example permissions may be verified by the interceptor, the log recording request information, determines whether the user login and the like.
To use Spring MVC in the interceptor, we need to define and configure the interceptor class. Typically interceptor class can be defined in two ways.
The first: by implementing HandlerInterceptor defined interface or inherit HandlerInterceptor interface implementation class (e.g. HandlerInterceptorAdapter).
The second: to achieve WebRequestInterceptor defined by the interface, or inherit WebRequestInterceptor interface implementation class.