0 Replies Latest reply on Jan 17, 2007 12:06 PM by ajay662

    sharing ejb3 style interceptors with ejb2.1 beans

    ajay662

      My application is a mix of ejb2.1 and ejb3 beans (actually mostly ejb2.1... have just started doing new development using ejb3).

      I am thinking of using ejb3 style interceptors to do audit logging of my application.

      My interceptor class

      public class AuditLoggger {
      
       @AroundInvoke
       public Object log(InvocationContext ctx) throws Exception {
       [CODE TO APPEND TO AUDIT LOG]
       }
      }


      Using this to to audit log my ejb3 bean methods is straightforward

      public @Stateless class AccountManagerBean implements AccountManager {
      
       @Interceptors({AuditLoggger.class})
       public long createAccount (String user) {
       }
      }


      My question is can I use the same interceptor class with my ejb2.1 beans? How?