Spring拦截器与servlet过滤器 [英] Spring interceptor vs servlet filter

查看:514
本文介绍了Spring拦截器与servlet过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring拦截器对servlet过滤器有什么优势?

What advantages does a Spring interceptor have over a servlet filter?

推荐答案


  • 你可以注入拦截器中的其他bean

  • 您可以使用更高级的映射模式(ant-style)

  • 您可以使用目标处理程序对象(控制器),以及结果 ModelAndView

  • 这是一个bean,所以你可以使用AOP(虽然很少见)

    • You can inject other beans in the interceptor
    • You can use more advanced mapping patterns (ant-style)
    • You have the target handler object (controller) available, as well as the result ModelAndView
    • It is a bean, so you can use AOP with it (althoug that would be rare)
    • 这篇关于Spring拦截器与servlet过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆