Is there any difference between EJB Interceptors declared in ejb-jar.xml file vs CDI interceptors declared in beans.xml file?
Both interceptors are declared using annotation @Interceptors. If CDI interceptors apply to EJBs as well then why do EJB interceptors exists?
You are right, they are basically the same but the CDI interceptors are little bit more sophisticated - they contain for example Interceptor binding. See Weld documentation for reference. Note that there will be probably effort in the future for uniting EJB and CDI (for instance CDI 1.1 allows you to use JTAs declarative transactions which effectively replaces EJB ones) so I expect those two projects to merge in next few years.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With