I\'m trying to clear my concept about Interceptors in Java EE. I have read Java EE specification but I\'m little confused about it. Please provide me some useful link or tutoria
Interceptors are used to add AOP capability to managed beans.
We can attach Interceptor to our class using @Interceptor annotation. Whenever a method in our class is called, the attached Interceptor will intercept that method invocation and execute its interceptor method.
This can be achieved using @AroundInvoke annotation ( see example below ).
We can intercept life cycle events of a class ( object creation,destroy etc) using @AroundConstruct annotation.
Main difference between Interceptor and Servlet Filters is We can use Interceptor outside WebContext, but Filters are specific to Web applications.
Common uses of interceptors are logging, auditing, and profiling.
For more detailed introduction, you can read this article. https://abhirockzz.wordpress.com/2015/01/03/java-ee-interceptors/