@Aspect
@Component
public class AnchorMonitor {
@Around(value = "@annotation(anchor)", argNames="anchor")
// @Around(value = "@annotation(anchor)", argNames="joinPoint, anchor") // OK too.
public Object replaceFirstArg(ProceedingJoinPoint joinPoint, Anchor anchor) throws Throwable {
System.out.println("[AOP] joinPoint: " + joinPoint);
System.out.println("[AOP] anchor.id: " + anchor.id());
Object[] args = joinPoint.getArgs();
if (args[0] == null) args[0] = anchor.id();
return joinPoint.proceed(args);
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Spring Boot AOP Sample -- @around(value = "@annotation(anchor)", argNames="anchor")
panlw/using-springboot-aop
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Spring Boot AOP Sample -- @around(value = "@annotation(anchor)", argNames="anchor")
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published