What is the difference between a Spring MVC interceptor and a web filter?

A Spring MVC interceptor and a servlet filter both let you run code around request processing, but they operate at different layers — one inside the Spring framework, the other at the raw servlet container level.

Key Points

Example

A team might use a filter to enforce a consistent UTF-8 character encoding across the whole app, while using an interceptor to log the specific controller method and execution time for every Spring-handled request.

Interview Tip

A concise interview answer is

An interceptor is Spring-specific and runs around the handler method inside DispatcherServlet's dispatch, giving it access to the handler and model. A filter is part of the Servlet API, runs for every request before it even reaches DispatcherServlet, and is better suited to generic, framework-agnostic concerns like compression or encoding.

Last updated: 16 July 2026

Previous question: How can you configure a Spring MVC interceptor to apply globally?

Next question: Discuss exception handling in Spring MVC.

More Spring MVC (Optional) interview questions

All Spring MVC (Optional) questions