What are Aspect, Advice, Po...
What are Aspect, Advice, Po...
In Aspect-Oriented Programming (AOP), several key terminologies are essential to understand the framework, particularly when working with Spring AOP. These terms are Aspect, Advice, Pointcut, and JoinPoint. Here's a detailed explanation of each:
An Aspect is a modularization of a concern that cuts across multiple classes. It is the unit of modularity similar to a class in Object-Oriented Programming (OOP). Aspects enable the encapsulation of behaviors affecting multiple classes into reusable modules. This encapsulation can include behaviors like transaction management, logging, or security features, which are typically scattered across several classes and methods. In Spring AOP, aspects are implemented using regular classes annotated with @Aspect
or defined in an XML configuration[1][2][3].
Advice defines the action that an aspect takes at a particular join point. In other words, it is the actual code that is executed during the program execution by the AOP framework. There are several types of advice:
ProceedingJoinPoint.proceed()
[1][2][3][5].A Pointcut is a predicate or expression that matches join points, which are poin...
senior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào