SlideShare a Scribd company logo
SPRING FRAMEWORK
3.0
Aspect Oriented Programming with
Spring Framework -
AOP
What is
AOP?
 is a programming paradigm
 extends OOP
 enables modularization of crosscutting
concerns
 is second heart of Spring Framework
A simple service
method
public Order getOrder(BigDecimal orderId) {
return (Order) factory.openSession()
.get(Order.class, orderId);
}
Add permissions
check
public Order getOrder(BigDecimal orderId) {
if (hasOrderPermission(orderId)) {
return (Order) factory.openSession()
.get(Order.class, orderId);
} else {
throw new SecurityException("Access Denied");
}
}
Add transaction
management
public Order getOrder(BigDecimal orderId) {
if (hasOrderPermission(orderId)) {
Order order;
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
try {
order = (Order) session.get(Order.class,
orderId);
tx.commit();
} catch (RuntimeException e) {if (tx!=null)
{tx.rollback();}
} finally {session.close();}
return order;
} else { throw new SecurityException("Access
Denied");}
}
Add
cache
public Order getOrder(BigDecimal orderId) {
if (hasOrderPermission(orderId)) {
Order order = (Order)cache.get(orderId);
if (order==null) {
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
try {
order = (Order) session.get(Order.class,
orderId);
tx.commit();
cache.put(orderId, order);
} catch (RuntimeException e)
{if (tx!=null)
{tx.rollback();}
} finally {session.close();}
}
return order;
} else { throw new
SecurityException("Access Denied");}
}
A similar problem at enterprise
level
What does AOP
solve?
Logging
Validatio
n
Caching
Security
Transactions
Monitoring
Error
Handling
Etc…
AOP
concepts
 aspect
 advice
 pointcut
 join
point
AOP and
OOP
1. Aspect – code unit that
encapsulates pointcuts,
advice, and attributes
2. Pointcut – define the set
of entry points (triggers)
in which advice is
executed
3. Advice –
implementation of
cross cutting concern
4. Weaver – construct
code
(source or object) with
1. Class – code unit that
encapsulates methods
and attributes
2. Method signature – define
the entry points for the
execution of method
bodies
3. Method bodies –
implementation of the
business logic concerns
4. Compiler – convert source
code
to object code
AOP OOP
AOP
concepts(2)
 introduction
 target
object
 AOP proxy
 weaving
 compile
time
 load time
 runtime
Spring
AOP
 implemented in pure java
 no need for a special compilation
process
 supports only method execution join
points
 only runtime weaving is available
 AOP proxy
 JDK dynamic proxy
 CGLIB proxy
 configuration
 @AspectJ annotation-style
 Spring XML configuration-style
@AspectJ
Declaring
aspect
@Aspect
public class EmptyAspect {
}
<!--<context:annotation-config />-->
<aop:aspectj-autoproxy proxy-target-class="false | true"/>
<bean
class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator">
</bean>
<bean class="example.EmptyAspect"/>
Pointcut
designators
 code
based
 execution
 within
 target
 this
 args
 bean
Pointcut
designators(2)
 annotation
based
 @annotation
 @within
 @target
 @args
Format of an execution
expression
execution(
modifiers-pattern
returning-type-pattern
declaring-type-pattern
name-pattern(param-
pattern)
throws-pattern
)
Simple pointcut
expressions
@Aspect
public class ItemStatusTracker {
@Pointcut("execution(* approve(..))")
public void ifApprove() {}
@Pointcut("execution(* reject(..))")
public void ifReject() {}
@Pointcut("ifApprove() || ifReject()")
public void ifStateChange() {}
}
Execution
examples
any public method
execution(public * * (..))"
any method with a name beginning with
"get"
execution(* get*(..))
any method defined by the appropriate
interface
execution(* bank.BankService.*(..))
any method defined in the appropriate
package
execution(* com.epam.pmc.service.*.*(..))
other examples
http://static.springsource.org/spring/docs/3.0.x/spring-fra
Advic
e
 associated with a pointcut
expression
 a simple reference to a named
pointcut
 a pointcut expression declared in
place
 runs
 before
 after returning
 after throwing
 after (finally)
Before
advice
@Aspect
public class BankAspect {
@Pointcut("execution(public * * (..))")
public void anyPublicMethod() {}
@Before("anyPublicMethod()")
public void logBefore(JoinPoint joinPoint) {
//to do something
}
}
After returning
advice
@Aspect
public class BankAspect {
@AfterReturning( pointcut="executio
n(* get*(..))",
returning="retVal")
public void logAfter(JoinPoint
joinPoint, Object retVal) {
//to do something
}
}
After throwing
advice
@Aspect
public class BankAspect {
@AfterThrowing(
pointcut = "execution(* bank..*ServiceImpl.add*(..))",
throwing = "exception")
public void afterThrowing(Exception exception) {
//to do something
}
}
After finally
advice
@Aspect
public class BankAspect {
@Pointcut("execution(public * * (..))")
public void anyPublicMethod() {}
@After(value="anyPublicMethod() && args(from, to)")
public void logAfter(JoinPoint jp, String from, String to) {
//to do something
}
}
Around
advice
@Aspect
public class BankCacheAspect {
@Around("@annotation(bank.Cached)")
public Object aroundCache(ProceedingJoinPoint joinPoint){
//to do something before
Object retVal = joinPoint.proceed();
//to do something after
}
}
Aspect and advice
ordering
 order of advice in the same aspect
 before
 around
 after finally
 after returning or after throwing
 Spring interface for ordering aspects
 org.springframework.core.Ordered
 Spring annotation
 org.springframework.core.annotation.O
rder
Declaring an
aspect
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http
://www.w3.org/2001/XMLSchema-instance" xmlns:aop=
"http://www.springframework.org/schema/aop"
xsi:schemaLocation="…">
<aop:config>
<aop:aspect id="bankAspectId" ref="bankAspect">
<aop:pointcut id="anyPublicMethod"
expression="execution(public * *
(..))"/>
<aop:before pointcut-ref="anyPublicMethod"
method="logBefore"/>
</aop:aspect>
</aop:config>
<bean id="bankAspect" class="bank.BankAspect"/>
</beans>
Bean in Spring
container
Standard OOP implementation Implementation with AOP
AOP
proxies
Invoke directly Invoke via proxy
How it really
works
Introduction behaviors to
bean
@Aspect
public class CalculatorIntroduction {
@DeclareParents(
value = "calculator.ArithmeticCalculatorImpl",
defaultImpl = MaxCalculatorImpl.class)
public MaxCalculator maxCalculator;
@DeclareParents(
value = "calculator.ArithmeticCalculatorImpl",
defaultImpl = MinCalculatorImpl.class)
public MinCalculator minCalculator;
}
Introduction states to
bean
@Aspect
public class BankServiceIntroductionAspect {
@DeclareParents(
value="bank.BankServiceImpl",
defaultImpl=DefaultCounterImpl.class)
public Counter mix;
@Before("execution(* get*(..)) &&
this(auditable)")
public void useBusinessService(Counter auditable) {
auditable.increment();
}
}
Spring AOP vs
AspectJ
 no need for a
special compilation
process
 support only
method execution
pointcuts
 advise the
execution of
operations on
 need AspectJ
compiler or setup
LTW
 support all pointcuts
 advice all
domain objects
Spring AOP AspectJ
@AspectJ vs
XML
 has more
opportunities, such
as combine named
pointcuts
 encapsulate the
implementation of the
requirement it
addresses in a single
place
 can be used with
any JDK level
 good choice to
configure
enterprise
services
@AspectJ XML
Link
s
 Useful links
 Wiki: Aspect-oriented programming
http://en.wikipedia.org/wiki/Aspect-oriented_program
ming
 Spring Reference
http://static.springsource.org/spring/docs/3.0.x/sp
ring-
framework-reference/html/aop.html
 AspectJ home site
http://www.eclipse.org/aspectj/
https://www.jbktutorials.com/spring-aop/types-
Book
s

More Related Content

PPTX
spring aop.pptxfgfdgfdgfdgfdgfdgvbvcbvbcvbdf
PDF
Spring Framework - AOP
PPTX
Spring framework part 2
ODP
Aspect-Oriented Programming
PDF
Apche Spark SQL and Advanced Queries on big data
PDF
Durable functions 2.0 (2019-10-10)
PPTX
[NDC 2019] Enterprise-Grade Serverless
PPTX
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
spring aop.pptxfgfdgfdgfdgfdgfdgvbvcbvbcvbdf
Spring Framework - AOP
Spring framework part 2
Aspect-Oriented Programming
Apche Spark SQL and Advanced Queries on big data
Durable functions 2.0 (2019-10-10)
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless

Similar to spring aop.pptx aspt oreinted programmin (20)

PDF
Azure Durable Functions (2019-04-27)
PPTX
Spring aop concepts
PDF
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
PPT
JS everywhere 2011
PPTX
Module design pattern i.e. express js
PDF
Azure Durable Functions (2019-03-30)
PPTX
Analytics Metrics delivery and ML Feature visualization: Evolution of Data Pl...
PDF
Spring boot
PDF
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
PPT
We sport architecture_implementation
PPT
Spring AOP @ DevClub.eu
PDF
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
PPTX
Google cloud Dataflow & Apache Flink
PDF
Full Stack Scala
PDF
Flask and Angular: An approach to build robust platforms
PPTX
Exploring Kotlin
PPTX
Reactive programming every day
PDF
A Deep Dive into Query Execution Engine of Spark SQL
PDF
Apache Beam de A à Z
Azure Durable Functions (2019-04-27)
Spring aop concepts
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
JS everywhere 2011
Module design pattern i.e. express js
Azure Durable Functions (2019-03-30)
Analytics Metrics delivery and ML Feature visualization: Evolution of Data Pl...
Spring boot
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
We sport architecture_implementation
Spring AOP @ DevClub.eu
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
Google cloud Dataflow & Apache Flink
Full Stack Scala
Flask and Angular: An approach to build robust platforms
Exploring Kotlin
Reactive programming every day
A Deep Dive into Query Execution Engine of Spark SQL
Apache Beam de A à Z
Ad

More from zmulani8 (20)

PPTX
Chapter-9-MySQL.pptxxzrtyryrydfdsfdsfdsrter
PPTX
unit 2 Mastering-State-Management-in-React.pptx
PPTX
Lect 4.pptxdsdsdsdfgxgf xzffss sdsdsffff
PPTX
sql functions.pptxghghghghghghghbvnbghjj
PPTX
session_2_sqlpptxfhfhfhfdhfdhkkfdhfdhfdh
PPTX
unit_1_foss_2.pptxbfhfdhfgsdgtsdegtsdtetg
PPTX
unit_1_spring_1.pptxfgfgggjffgggddddgggg
PPTX
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
PPTX
Some more Concepts of DOT cvcvcvNET.pptx
PPTX
DOT NET Framework.pptxdsfdsfdsfsdfdsfdsfdsf
PDF
ipsec.pdfgvdgvdgdgdgddgdgdgdgdgdgdgdgdgd
PPT
unit 2 intr to phy layer part 1.pptcvcvcv
PPT
JSP 1.pptdfdfdfdsfdsfdsfdsfdsgdgdgdgdgdd
PPTX
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
PPT
introduction.pptdasdasdadasdasdsddsdsads
PPTX
PE introd.pptxdsdsdsdasdsdsddadqwdqwdqwdqw
PPTX
Pre_requisties of ML Lect 1.pptxvcbvcbvcbvcb
PPTX
introduction TO DS 1.pptxvbvcbvcbvcbvcbvcb
PPTX
IANSunit 1_cryptography_2.pptxv xvxvxvxv
PPT
ch03.pptvxcvxcvxcvxcvxcvxcvcxvdsgedgeeee
Chapter-9-MySQL.pptxxzrtyryrydfdsfdsfdsrter
unit 2 Mastering-State-Management-in-React.pptx
Lect 4.pptxdsdsdsdfgxgf xzffss sdsdsffff
sql functions.pptxghghghghghghghbvnbghjj
session_2_sqlpptxfhfhfhfdhfdhkkfdhfdhfdh
unit_1_foss_2.pptxbfhfdhfgsdgtsdegtsdtetg
unit_1_spring_1.pptxfgfgggjffgggddddgggg
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
Some more Concepts of DOT cvcvcvNET.pptx
DOT NET Framework.pptxdsfdsfdsfsdfdsfdsfdsf
ipsec.pdfgvdgvdgdgdgddgdgdgdgdgdgdgdgdgd
unit 2 intr to phy layer part 1.pptcvcvcv
JSP 1.pptdfdfdfdsfdsfdsfdsfdsgdgdgdgdgdd
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
introduction.pptdasdasdadasdasdsddsdsads
PE introd.pptxdsdsdsdasdsdsddadqwdqwdqwdqw
Pre_requisties of ML Lect 1.pptxvcbvcbvcbvcb
introduction TO DS 1.pptxvbvcbvcbvcbvcbvcb
IANSunit 1_cryptography_2.pptxv xvxvxvxv
ch03.pptvxcvxcvxcvxcvxcvxcvcxvdsgedgeeee
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
DOCX
573137875-Attendance-Management-System-original
PPTX
Artificial Intelligence
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Sustainable Sites - Green Building Construction
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Geodesy 1.pptx...............................................
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
573137875-Attendance-Management-System-original
Artificial Intelligence
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Safety Seminar civil to be ensured for safe working.
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Operating System & Kernel Study Guide-1 - converted.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
OOP with Java - Java Introduction (Basics)
Embodied AI: Ushering in the Next Era of Intelligent Systems
CH1 Production IntroductoryConcepts.pptx
Sustainable Sites - Green Building Construction
Mechanical Engineering MATERIALS Selection
Foundation to blockchain - A guide to Blockchain Tech
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

spring aop.pptx aspt oreinted programmin

  • 1. SPRING FRAMEWORK 3.0 Aspect Oriented Programming with Spring Framework - AOP
  • 2. What is AOP?  is a programming paradigm  extends OOP  enables modularization of crosscutting concerns  is second heart of Spring Framework
  • 3. A simple service method public Order getOrder(BigDecimal orderId) { return (Order) factory.openSession() .get(Order.class, orderId); }
  • 4. Add permissions check public Order getOrder(BigDecimal orderId) { if (hasOrderPermission(orderId)) { return (Order) factory.openSession() .get(Order.class, orderId); } else { throw new SecurityException("Access Denied"); } }
  • 5. Add transaction management public Order getOrder(BigDecimal orderId) { if (hasOrderPermission(orderId)) { Order order; Session session = factory.openSession(); Transaction tx = session.beginTransaction(); try { order = (Order) session.get(Order.class, orderId); tx.commit(); } catch (RuntimeException e) {if (tx!=null) {tx.rollback();} } finally {session.close();} return order; } else { throw new SecurityException("Access Denied");} }
  • 6. Add cache public Order getOrder(BigDecimal orderId) { if (hasOrderPermission(orderId)) { Order order = (Order)cache.get(orderId); if (order==null) { Session session = factory.openSession(); Transaction tx = session.beginTransaction(); try { order = (Order) session.get(Order.class, orderId); tx.commit(); cache.put(orderId, order); } catch (RuntimeException e) {if (tx!=null) {tx.rollback();} } finally {session.close();} } return order; } else { throw new SecurityException("Access Denied");} }
  • 7. A similar problem at enterprise level
  • 9. AOP concepts  aspect  advice  pointcut  join point
  • 10. AOP and OOP 1. Aspect – code unit that encapsulates pointcuts, advice, and attributes 2. Pointcut – define the set of entry points (triggers) in which advice is executed 3. Advice – implementation of cross cutting concern 4. Weaver – construct code (source or object) with 1. Class – code unit that encapsulates methods and attributes 2. Method signature – define the entry points for the execution of method bodies 3. Method bodies – implementation of the business logic concerns 4. Compiler – convert source code to object code AOP OOP
  • 11. AOP concepts(2)  introduction  target object  AOP proxy  weaving  compile time  load time  runtime
  • 12. Spring AOP  implemented in pure java  no need for a special compilation process  supports only method execution join points  only runtime weaving is available  AOP proxy  JDK dynamic proxy  CGLIB proxy  configuration  @AspectJ annotation-style  Spring XML configuration-style
  • 14. Declaring aspect @Aspect public class EmptyAspect { } <!--<context:annotation-config />--> <aop:aspectj-autoproxy proxy-target-class="false | true"/> <bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"> </bean> <bean class="example.EmptyAspect"/>
  • 15. Pointcut designators  code based  execution  within  target  this  args  bean
  • 17. Format of an execution expression execution( modifiers-pattern returning-type-pattern declaring-type-pattern name-pattern(param- pattern) throws-pattern )
  • 18. Simple pointcut expressions @Aspect public class ItemStatusTracker { @Pointcut("execution(* approve(..))") public void ifApprove() {} @Pointcut("execution(* reject(..))") public void ifReject() {} @Pointcut("ifApprove() || ifReject()") public void ifStateChange() {} }
  • 19. Execution examples any public method execution(public * * (..))" any method with a name beginning with "get" execution(* get*(..)) any method defined by the appropriate interface execution(* bank.BankService.*(..)) any method defined in the appropriate package execution(* com.epam.pmc.service.*.*(..)) other examples http://static.springsource.org/spring/docs/3.0.x/spring-fra
  • 20. Advic e  associated with a pointcut expression  a simple reference to a named pointcut  a pointcut expression declared in place  runs  before  after returning  after throwing  after (finally)
  • 21. Before advice @Aspect public class BankAspect { @Pointcut("execution(public * * (..))") public void anyPublicMethod() {} @Before("anyPublicMethod()") public void logBefore(JoinPoint joinPoint) { //to do something } }
  • 22. After returning advice @Aspect public class BankAspect { @AfterReturning( pointcut="executio n(* get*(..))", returning="retVal") public void logAfter(JoinPoint joinPoint, Object retVal) { //to do something } }
  • 23. After throwing advice @Aspect public class BankAspect { @AfterThrowing( pointcut = "execution(* bank..*ServiceImpl.add*(..))", throwing = "exception") public void afterThrowing(Exception exception) { //to do something } }
  • 24. After finally advice @Aspect public class BankAspect { @Pointcut("execution(public * * (..))") public void anyPublicMethod() {} @After(value="anyPublicMethod() && args(from, to)") public void logAfter(JoinPoint jp, String from, String to) { //to do something } }
  • 25. Around advice @Aspect public class BankCacheAspect { @Around("@annotation(bank.Cached)") public Object aroundCache(ProceedingJoinPoint joinPoint){ //to do something before Object retVal = joinPoint.proceed(); //to do something after } }
  • 26. Aspect and advice ordering  order of advice in the same aspect  before  around  after finally  after returning or after throwing  Spring interface for ordering aspects  org.springframework.core.Ordered  Spring annotation  org.springframework.core.annotation.O rder
  • 27. Declaring an aspect <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xmlns:aop= "http://www.springframework.org/schema/aop" xsi:schemaLocation="…"> <aop:config> <aop:aspect id="bankAspectId" ref="bankAspect"> <aop:pointcut id="anyPublicMethod" expression="execution(public * * (..))"/> <aop:before pointcut-ref="anyPublicMethod" method="logBefore"/> </aop:aspect> </aop:config> <bean id="bankAspect" class="bank.BankAspect"/> </beans>
  • 28. Bean in Spring container Standard OOP implementation Implementation with AOP
  • 31. Introduction behaviors to bean @Aspect public class CalculatorIntroduction { @DeclareParents( value = "calculator.ArithmeticCalculatorImpl", defaultImpl = MaxCalculatorImpl.class) public MaxCalculator maxCalculator; @DeclareParents( value = "calculator.ArithmeticCalculatorImpl", defaultImpl = MinCalculatorImpl.class) public MinCalculator minCalculator; }
  • 32. Introduction states to bean @Aspect public class BankServiceIntroductionAspect { @DeclareParents( value="bank.BankServiceImpl", defaultImpl=DefaultCounterImpl.class) public Counter mix; @Before("execution(* get*(..)) && this(auditable)") public void useBusinessService(Counter auditable) { auditable.increment(); } }
  • 33. Spring AOP vs AspectJ  no need for a special compilation process  support only method execution pointcuts  advise the execution of operations on  need AspectJ compiler or setup LTW  support all pointcuts  advice all domain objects Spring AOP AspectJ
  • 34. @AspectJ vs XML  has more opportunities, such as combine named pointcuts  encapsulate the implementation of the requirement it addresses in a single place  can be used with any JDK level  good choice to configure enterprise services @AspectJ XML
  • 35. Link s  Useful links  Wiki: Aspect-oriented programming http://en.wikipedia.org/wiki/Aspect-oriented_program ming  Spring Reference http://static.springsource.org/spring/docs/3.0.x/sp ring- framework-reference/html/aop.html  AspectJ home site http://www.eclipse.org/aspectj/ https://www.jbktutorials.com/spring-aop/types-