AOP:
Aspect Oriented Programming(AOP) is used to handle cross cutting concerns across different types of objects.AOP is used with OOP.
AOP address the core concerns such as transaction management,event logging,security,exception handling etc. across all the objects.Unit of code in AOP is an Aspect,where as unit of code in OOP is object.
Object Oriented Programming(OOP) methodology is to represent every thing as an object and to use its principles like Inheritance, Polymorphism , Encapsulation
Aspect Oriented Programming(AOP) is used to handle cross cutting concerns across different types of objects.AOP is used with OOP.
AOP address the core concerns such as transaction management,event logging,security,exception handling etc. across all the objects.Unit of code in AOP is an Aspect,where as unit of code in OOP is object.
Object Oriented Programming(OOP) methodology is to represent every thing as an object and to use its principles like Inheritance, Polymorphism , Encapsulation
To program a Aspect,we need to know about the following important terms.
JoinPoint: JoinPoint is a point during program execution.Usually it is a method.
PointCut: Pointcut is a predicate,that matches the joinpoint.
Advice: Advice is the action need to be taken by aspect at the joinpoint.It is associated with pointcut.
Different types of advice are
- Before:Executes before joinpint.
- After:Executes affter joinpoint
- Around:Executes around joinpoint. Advice can be programmed to not to execute joinpoint.
Spring AOP:
Spring AOP builds proxy object to target object,when it detects the Aspect for the target object.
Sample Application
Sample Application