Spring Interceptor does not intercept method name reason

Source: Internet
Author: User

Development of a note-based login blocker, the interceptor can only intercept the controller can not intercept the specific method name, so that the interceptor is completely useless, after careful groping, Defaultannotationhandlermapping and Annotationmethodhandleradapter do not support interception methods, It is only supported after the 3.1 release and needs to be replaced with requestmappinghandlermapping and requestmappinghandleradapter, or it can be used directly by introducing Annotation-driven. Then you'll find the Interceptor intercept method name, and you'll be able to scan the annotations.

A few key versions of the change information

After spring2.5
Requires processor-mapped defaultannotationhandlermapping and processor adapter Annotationmethodhandleradapter to turn on support @controller and @ Requestmapping the annotated processor.


Spring3.1 use
The new handlermapping and Handleradapter support the @contoller and @requestmapping annotation processors.
New @contoller and @requestmapping annotation support classes: Processor mapping requestmappinghandlermapping and Processor Adapter Requestmappinghandleradapter combination to replace Spring2.5 start processor mapping defaultannotationhandlermapping and processor adapter ANNOTATIONMETHODHANDLERADAP ter, providing more extensibility points.



In spring MVC 3.1, the strain is more
Defaultannotationhandlermapping Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
Annotationmethodhandleradapter Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
Annotationmethodhandlerexceptionresolver-Exceptionhandlerexceptionresolver


The above are automatically registered after using the Annotation-driven

Spring Interceptor does not intercept method name reason

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.