Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JoinPoint或ProceedingJoinPoint';s对象可以调用方法吗?_Java_Spring Mvc_Interface_Aspectj_Spring Aop - Fatal编程技术网

Java JoinPoint或ProceedingJoinPoint';s对象可以调用方法吗?

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

AspectJ的连接点是一个接口,而ProceedingJoinPoint也是一个扩展连接点的接口

但是,当我在方面中使用它们时,我可以直接使用它们的实例和方法

@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 {..}