1
ThisJoinPoint只能獲取當前的方法信息,無論如何獲取來電者的方法信息?如何獲得來自周圍的來電者方法信息提醒
ThisJoinPoint只能獲取當前的方法信息,無論如何獲取來電者的方法信息?如何獲得來自周圍的來電者方法信息提醒
@Aspect
public class LoggingAspect {
@Before(value = "execution(public * findAll())")
public void beforeAdvice(JoinPoint pp){
System.out.println("before advice called ....get calling method Signature"+pp.getSignature());
System.out.println("before advice called ....get calling method name"+pp.getSignature().getName());
}
}
如何從@AspectJ語法獲取此信息? – user496949 2011-04-12 06:24:47
傳遞給advice方法的參數:'JoinPoint.EnclosingStaticPart thisEnclosingJoinPointStaticPart'(取自[here](http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj-pcadvice.html)) – janhink 2011-04-12 06:28:21
更新了回答 – janhink 2011-04-12 06:34:52