In this chapter, we have seen that interceptors and decorators are the platforms through which the JEE platform provides aspect-oriented programming. Interceptors are used to interpose the invocation of some method or life cycle events that occur in an associated target class. The interceptor takes care of technical tasks, called crosscutting tasks, that are repeated throughout an application, such as logging, auditing, and exception handling. These tasks are separate from business logic, and it's a good idea to put the interceptor in a separate class for easy maintenance.
We learned how the classic interceptor mechanism works for EJB, as well as the CDI inspector mechanism, which can intercept any managed bean and not just EJB-managed beans.
While the interceptor takes care of the technical tasks, we can add functionality to the existing business logic...