CDI interceptor implementation
Along with the introduction to the CDI mechanism, a new approach to interceptors was built based on the functionality of the Java EE interceptors that were previously seen. With the CDI engine, you can intercept business methods for the CDI-managed beans, not just for the EJB beans. A key difference for the interceptor under the CDI context is the way in which the interceptor is injected into the managed bean. We now have the concept of the interceptor binding type. This is an annotation that qualifies the desired type of interceptor for the bean.
Suppose we want to create an interceptor for logging. In this case, we would initially create an interceptor binding type named @Loggable, which is described as follows: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access