Class AopContext


public abstract class AopContext
extends java.lang.Object

Class containing static methods used to obtain information about the current AOP invocation. The currentInvocation() method--the only public method in this class--is usable only if the AOP framework is configured to expose invocations. The framework does not expose invocation contexts by default, as there is a performance cost in doing so.
The functionality in this class might be used by a target object that needed access to resources on the invocation. However, this approach should not be used when there is a reasonable alternative, as it makes application code dependent on usage under AOP and--specifically--the Spring AOP framework.

$Id:,v 1.2 2003/04/08 20:30:14 johnsonr Exp $
Rod Johnson

Constructor Summary
Method Summary
static org.aopalliance.MethodInvocation currentInvocation()
          Try to return the current AOP invocation.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public AopContext()
Method Detail


public static org.aopalliance.MethodInvocation currentInvocation()
Try to return the current AOP invocation. This method is usable only if the calling method has been invoked via AOP, and the AOP framework has been set to expose invocations. Otherwise, this method will throw AspectException.
MethodInvocation the current AOP invocation. Never returns null.
org.aopalliance.AspectException - if the invocation cannot be found, because the method was invoked outside an AOP invocation context or because the AOP framework has not been configured to expose the invocation context.

Rod Johnson and Spring contributors 2001-2003.