Performance: @Aspect annotation
MEDIUM IMPACT
This affects application runtime performance by adding extra method interception and proxy creation overhead.
@Aspect public class LoggingAspect { @Before("execution(* com.example.service.UserService.getUser(..))") public void logBefore() { // logging logic } }
@Aspect public class LoggingAspect { @Before("execution(* com.example..*(..))") public void logBefore() { // logging logic } }
| Pattern | Proxy Creation | Method Call Overhead | Memory Impact | Verdict |
|---|---|---|---|---|
| Broad @Aspect pointcut (e.g., all methods in package) | High (many proxies) | High (all calls intercepted) | Medium (proxy objects) | [X] Bad |
| Narrow @Aspect pointcut (specific methods only) | Low (few proxies) | Low (few calls intercepted) | Low (less proxy objects) | [OK] Good |