定义
@Before声明一个方法为后置通知。
参数
value
String value();
可以为切入点表达式,也可以为使用了@PointCut被声明为切入点的方法。
示例
Link to original @Aspect @Component @Slf4j public class LogAspect { @PointCut("@annotation(com.example.annotation.Log)") public void logAnnotation() { } @After("logAnnotation()") public void logAfter(JoinPoint joinPoint) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); log.info(“after method:{}”, method.getName()); } }