Using deployment descriptor for default interceptors
Default interceptors are intended to be executed for every session and message-driven EJB in the EJB module. However, default interceptors can only be declared within the
ejb-jar.xml deployment descriptor. This recipe will illustrate this technique.
The process for creating a deployment descriptor for default interceptors includes:
- Creating an
ejb-jar.xmlfile for the EJB module
- Using the
<interceptors>element to define your interceptors
- Adding an
<interceptor-binding>element to bind the interceptor to an EJB
- Deploying the application
The basic structure of the XML elements is as follows:
<interceptors> <interceptor> <interceptor-class>interceptorClass</interceptor-class> </interceptor> ...