Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Created January 3, 2015 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/89a5ffb20edc4d63dcd0 to your computer and use it in GitHub Desktop.
Save abhirockzz/89a5ffb20edc4d63dcd0 to your computer and use it in GitHub Desktop.
Intercerptor Binding
@InterceptorBinding
@Target({TYPE, METHOD, CONSTRUCTOR})
@Retention(RUNTIME)
public @interface @Auditable {
}
@Auditable
@Interceptor
public class AuditInterceptor {
@AroundInvoke
public Object audit(InvocationContext ictx) throws Exception{
//logic goes here
}
}
@Stateless
@Auditable
public class AnEJB{
public void bizMethod(){
//any calls to this method will be intercepted by AuditInterceptor.audit()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment