A default interceptor is invoked whenever any business method is invoked on any bean within the deployment. Default interceptors cannot be defined using annotations but must be specified using deployment descriptors within an ejb-jar.xml
file. Suppose we want the Auditor
interceptor class to be the default interceptor for all EJBs. The ejb-jar.xml
file to do this is shown below:
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"> <interceptors> <interceptor> <interceptor-class>ejb30.session.Auditor</interceptor-class> <around-invoke> <method-name>audit</method-name> </around-invoke> </interceptor> </interceptors> <assembly-descriptor> <interceptor-binding> <ejb-name>*<...