There are different types of interceptors that intercept various aspects (exceptions, before a method after method, etc.).. Create an interceptor method is as simple as making a class that inherits from org.aopalliance.intercept.MethodInterceptor. MethodInterceptor interceptor is wider there, and very easy to implement. The following is the log interceptor class instance :
Code:
com.dosideas.interceptor package;
org.aopalliance.intercept.MethodInterceptor import;
org.aopalliance.intercept.MethodInvocation import;
public class implements LogInterceptor MethodInterceptor (
public Object invoke (MethodInvocation invocation) throws Throwable (
System . out. println ("Start called");
Object rval = invocation. proc ();
System . out. println ("end call");
return rval;
)
)
Bookmarks