Interceptors in Java EE

Written on January 6, 2015

Interceptors are used to implement cross-cutting concerns such as auditing, logging, security related tasks, etc. from the actual business logic. Interceptors provide a clean separation between those cross-cutting concerns and the rest of the application logic. Overall, this separation simplify the development and the maintenance of the application.

Interceptors are not new. In fact, interceptors are nearly a decade old as the initial interceptor support has been introduced in Java EE 5… in the EJB 3.0 specification to be more precise. But in those nearly 10 years, Interceptors have evolved quite a lot and have now their own specification. The fact that interceptors are now independent of the EJB specification broadens their scope and reach to the complete Java EE platform.

Abhishek Gupta recently wrote a nice post on Interceptors. In his article, Abhishek start with the history of Interceptors and then goes on the different type of Interceptors and how to use them. And as usual, you can also check the Java EE Tutorial section on Interceptors and this sample if you want to learn about Interceptors.

Originaly posted on The Aquarium blog.