1、注解的示例为在方法入参上加后缀
代码示例:
@Component
@Aspect
public class HelloAspect {
// 将此类的解析指向注解
@Pointcut("@annotation(com.annotation.annotationImpl.WoToken)")
private void cut() {
//切点
}
@Around("cut()&&@annotation(woToken)")
public Object advice(ProceedingJoinPoint joinPoint, WoToken woToken) throws Throwable {
// 获取连接点方法运行时的入参列表
Object[] args = joinPoint.getArgs();
for (int i= 0;i<args.length;i++) {
String argValue = (String) args[i];
String s = argValue + woToken.value();
args[i] = s;
}
//执行
Object proceed = joinPoint.proceed(args);
return proceed;
}
}
代码示例:https://github.com/Pinshuducha/annotation
参考:https://blog.csdn.net/message_lx/article/details/77652260
参考代码:

原文:https://www.cnblogs.com/lu51211314/p/10375530.html