示例代码
后续相关的AOP源码研究示例代码皆以下面代码为测试跟踪。
如:
Spring AOP 源码探索 之深入解析实例化Bean过程创建代理类$Proxy
Aspect切面类
package org.silas;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import java.util.Arrays;
/**
* Created by silas on 2019/09/06.
*/
@Aspect
public class SilasLogAspect {
@Pointcut("execution(* org.silas.SilasCalculate.*(..))")
public void pointCut(){
};
@Before(value = "pointCut()")
public void methodBefore(JoinPoint joinPoint){
String methodName = joinPoint.getSignature().getName();
System.out.println("执行目标方法【"+methodName+"】前后执行<前置通知>,入参"+ Arrays.asList(joinPoint.getArgs()));
}
@After(value = "pointCut()")
public void methodAfter(JoinPoint joinPoint) {
String methodName = joinPoint.getSignature().getName();
System.out.println("执行目标方法【"+methodName+"】前后执行<后置通知>,入参"</