You are on page 1of 8

Spring AOP

Pichika Seshagiri
Basic
• Aspect-Oriented Programming(AOP)
• Complements OOP
• OOP Decomposes an programs into object.
• AOP decomposes a programs into aspects or
concerns like transaction management , logging
security etc.
• AOP enable modularization of concerns such as
transaction managements , could otherwise cut
across multiple object.
• Why AOP
• Simplifies application of cross cutting
concerns.
• Like Logging, transaction management.
• Security
• Auduting
• Event handling.
Concepts
• Joinpoint :
• Well defined point during the execution of you
application
• Where you can insert addition logic .
• Examples :
 Method invocation.
 Class initialization
 Object Intialization
Concept
• Advice :
• The code that is executed a the join point.
• Type of Advices :
• Before advice: which executes before joint
point.
• After Advice : which executes after the join
point.
• Around Advice : executes around join point.
• PointCut: Collection of join point that you use
to define where an advice should be
executed.
• By creating point cuts , fine –grained control
over how you apply advice to the
components.
• Examples:
• join point is a method invocation.
• A typical pointcut is a collection of all method
invocations in a particular class.

• Aspects : is combination of advice and


pointcut.
• Weaving : Process of actually inserting aspects
into the application code at the appropriate
point.
• Type of Weaving :
• Compile time
• Run time.
• Target :
• An object whose execution flow is modified by
the some AOP process.

You might also like