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] } }
public @Stateless class AccountManagerBean implements AccountManager { @Interceptors({AuditLoggger.class}) public long createAccount (String user) { } }