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?
From the course: Java EE: Contexts and Dependency Injection
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.