Method 1:
Block all URLs
< mvc:interceptors > < class= "Cn.ciss.interceptor.LoginInterceptor"/></ mvc:interceptors >
Method 2:
When intercepting a specified URL
<mvc:interceptors> <Mvc:interceptor> <!--/** means all folders and subfolders/* are all folders, not subfolders/The root directory of the Web project - <mvc:mappingPath="/**" /> <!--need to exclude blocked addresses - <!--<mvc:exclude-mapping path= "/usercontroller/login"/> - <BeanID= "Commoninterceptor"class= "Cn.ciss.interceptor.LoginInterceptor"></Bean> <!--This class is our custom interceptor. - </Mvc:interceptor> <!--when multiple interceptors are set, the Prehandle method is called sequentially and then the Posthandle and Aftercompletion methods of each interceptor are called in reverse order - </mvc:interceptors>
Method 3:
Precise injection of interceptors for a handlemapping
<Beanclass= "Org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> < Propertyname= "Interceptors"> <List> <Beanclass= "Cn.ciss.interceptor.LoginInterceptor"></Bean> </List> </ Property> </Bean>
SPRINGMVC Register Interceptor