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