28 January 2009

EJB3 default interceptors

To apply an interceptor class (auctionsystem.infra.EJBMonitor in this example) to all beans, add to the deployment descriptor (ejb-jar.xml):


The order in which interceptors are called is:
  1. default interceptors
  2. class level interceptors (interceptors on superclasses are called first)
  3. method level interceptors
To overrule calling of interceptors with larger scope use these annotations:
  1. @ExcludeDefaultInterceptors
  2. @ExcludeClassInterceptors
There are similar defaults for JPA, but these don't work currently in glassfish (issue 2821)