Performance: @Before advice
MEDIUM IMPACT
@Before advice affects the execution time before the main method runs, impacting interaction responsiveness and overall request handling speed.
@Before("execution(* com.example.service.*.*(..))") public void lightweightBeforeAdvice() { // simple logging or quick validation logger.info("Method called"); }
@Before("execution(* com.example.service.*.*(..))") public void heavyBeforeAdvice() throws InterruptedException { // heavy computation or blocking IO Thread.sleep(1000); // complex database calls }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy blocking @Before advice | N/A | N/A | N/A | [X] Bad |
| Lightweight logging @Before advice | N/A | N/A | N/A | [OK] Good |