From the course: Java EE: Contexts and Dependency Injection

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What are interceptors?

What are interceptors?

From the course: Java EE: Contexts and Dependency Injection

Start my 1-month free trial

What are interceptors?

- [Instructor] Interceptors are about adding behavior to existing code to solve cross-cutting concerns and are part of the aspect-oriented programming paradigm. Now, cross-cutting concerns are non-business-related concerns, such as logging and security. They do not solve a business problem, but nevertheless are an important part of an application's make up. The idea is that such concerns should not be addressed at the same time, or in the same place, as business concerns. And should therefore be separate from the application's business logic. Often, search functionality cuts across application layers and should be addressed away from the main code base. Interceptors rely on code injection to add the desired behavior or functionality to each point of an existing code base that is identified as a qualifying injection point. It does this by intercepting method calls and executing desired logic before and after it executes the method. So logging is a typical use codes for interceptors…

Contents