EJB Interceptors vs. CDI Interceptors

Is there a difference between EJB interceptors declared in an ejb-jar.xml file or CDI interceptors declared in a beans.xml file?

Both interceptors are declared using the @Interceptors annotation. If CDI interceptors also apply to EJBs, then why are there EJB interceptors?

+3
source share
1 answer

You are right, they are basically the same, but CDI interceptors are a bit more complicated - they contain, for example, interceptor interceptors. See welding documentation for reference. Please note that in the future, consolidation of EJBs and CDIs will probably require amplification (for example, CDI 1.1 allows the use of declarative JTA transactions that effectively replace EJBs), so I expect these two projects to be merged in the next few years.

+9
source

All Articles