Performance: @Around advice for full control
MEDIUM IMPACT
This affects the runtime execution speed and responsiveness of Spring Boot applications by intercepting method calls.
@Around("execution(* com.example..*(..))") public Object lightweightAdvice(ProceedingJoinPoint pjp) throws Throwable { // minimal pre-processing Object result = pjp.proceed(); // minimal post-processing return result; }
@Around("execution(* com.example..*(..))") public Object heavyAdvice(ProceedingJoinPoint pjp) throws Throwable { // heavy processing before Thread.sleep(100); // simulate delay Object result = pjp.proceed(); // heavy processing after Thread.sleep(100); // simulate delay return result; }
| Pattern | Method Interception Overhead | Thread Blocking | Latency Impact | Verdict |
|---|---|---|---|---|
| Heavy processing in @Around advice | High (every method call) | Yes (Thread.sleep) | High latency per call | [X] Bad |
| Lightweight @Around advice | Low (minimal code) | No | Minimal latency | [OK] Good |