Spring interceptor vs servlet filter

前端 未结 1 1945

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

1条回答
  •  情话喂你
    2021-02-13 19:09

    • 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)

    0 讨论(0)
提交回复
热议问题