Spring interceptor vs servlet filter

z12345 picture z12345 · Jan 20, 2012 · Viewed 10.7k times · Source

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

Answer

Bozho picture Bozho · Jan 20, 2012
  • 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)