> For the complete documentation index, see [llms.txt](https://dev7days.gitbook.io/dev7days/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev7days.gitbook.io/dev7days/java/filter-vs-interceptor.md).

# Filter vs Interceptor

Describe about Filter and Interceptor in Spring boot

<figure><img src="https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg" alt=""><figcaption><p>Reference from : <a href="https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg">https://www.baeldung.com/wp-content/uploads/2021/05/filters_vs_interceptors.jpg</a></p></figcaption></figure>

From this image , Filter isn't a part of Spring framework. It mainpulates request and response. It can block the request from client and also block response before reach client.

Interceptor is similar to **Filter** but it will intercept request between **Dispatcher Servlet** and **Controller**   &#x20;

**Use Case Filter**

* Authentication
* Logging and auditing

**Use Case Interceptor**

* Detailed authorization checks
* Manipulating the Spring context or model
