Java JoinPoint或ProceedingJoinPoint';s对象可以调用方法吗?
AspectJ的连接点是一个接口,而ProceedingJoinPoint也是一个扩展连接点的接口 但是,当我在方面中使用它们时,我可以直接使用它们的实例和方法Java JoinPoint或ProceedingJoinPoint';s对象可以调用方法吗?,java,spring-mvc,interface,aspectj,spring-aop,Java,Spring Mvc,Interface,Aspectj,Spring Aop,AspectJ的连接点是一个接口,而ProceedingJoinPoint也是一个扩展连接点的接口 但是,当我在方面中使用它们时,我可以直接使用它们的实例和方法 @Around("execution(* com.luv2code.aopdemo.dao.service.*.getFortune(..))") public Object aroundGetFortune( ProceedingJoinPoint proceedingJoinPoint) throws Throwab
@Around("execution(* com.luv2code.aopdemo.dao.service.*.getFortune(..))")
public Object aroundGetFortune(
ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
String method = proceedingJoinPoint.getSignature().toShortString();
System.out.println("\n=======> Executing @Around on method: " + method);
return null;
}
这怎么可能?接口不是应该由一些要使用的类来实现吗
还是说演员是在AspectJ中幕后完成的
谢谢,在运行时,Spring框架提供的实例是的一个实现 从: 要回答您的问题,是的,Spring框架有一个接口实现
您可以调试Spring AOP程序以观察运行时发生的情况。这是Spring AOP的正确答案。当然AspectJ本身也有一个名为的实现@Tom_猫,你可能已经知道了,但是Spring AOP和AspectJ不一样。
public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint, JoinPoint.StaticPart {..}