多个拦截器同时生效时,组成了拦截器栈
顺序:先进后出
springmvc.xml配置
先拦截1后拦截2

<!-- 拦截器 -->
<mvc:interceptors>
    	<bean class="com.lee.interceptor.DemoInterceptor"></bean>
    	<bean class="com.lee.interceptor.DemoInterceptor2"></bean>
</mvc:interceptors>

输出

preHandle
preHandle2
demo.exe
postHandle2
postHandle
index.jsp
afterHandle2
afterHandle

执行顺序如下图
拦截器栈

相关文章:

猜你喜欢
  • 2021-07-26
  • 2021-10-08
  • 2021-12-27
  • 2021-04-18
  • 2022-01-03
  • 2022-12-23
  • 2021-05-08
相关资源
相似解决方案