Skip to main content

Spring Boot - Interceptor

Learn Spring Boot - Interceptor (REST API Development, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is an Interceptor? • When a request is delivered to a Spring controller, it must travel through one or more Interceptors before the controller handles it. • The concept is similar to a Servlet Filter. The difference: a Spring Interceptor intercepts only requests that are going to a Controller. • Before the request reaches the controller you can use an Interceptor to perform tasks such as user authentication, writing logs, and adding or modifying configuration. When do we use it? Use an interceptor when you need to act before the request reaches the controller and before the response is...

More lessons in REST API Development