public interface MethodInterceptor
An interceptor will be called instead of the normal method invocation for proxied beans. A typical scenario for an MethodInterceptor is transaction handling:
public Object intercept(Object bean, Method method, Object[] args) throws Exception {
startTransaction();
try {
method.invoke(bean, args);
commitTransaction();
} catch (Exception ex) {
rollbackTransaction();
} finally {
closeTransaction();
}
}
The MethodInterceptor, as any other bean, can enjoy depdendency injection via the @Inject annotation.InterceptCopyright © 2011-2012 Syse Data AS. All Rights Reserved.