Spring AOP

AOP : Aspect oriented programming
BANK Business Operation à withdraw, deposit, tax
Service à Transaction, security, JMS, Mail service

To separate Business and service logics we use AOP
Service + Business à AOP à Proxy à Controller à Viewpage
1.       Buzzwords
·         Aspect à a service
·         Advice à Service provider
·         Point cut à a point / a condition to execute aspects for business methods
·         Advice à point cut with advice combination
·         Proxy à weaver means combine. It combines Service and Business and returns Proxy
·         Target à Business Object.
We can do by
·    Programmatic
·    Xml
·    Annotations

2.      Types of Advices
·    Service may execute BEFORE business Logic à methodBeforeAdvice (before(obj[], Method m ))
·    Service may execute AFTER business Logic  àAfterReturningAdvice
·    Service may execute BEFORE and AFTER business Logic  à MethodInterceptor
·         proceed() method differentiatres the BEFORE n AFTER code Excecution
·    Service may execute EXCEPTION in business Logic  à ThrowsAdvice
·    All are Interfaces.
·    All are Advices

At Runtime Service and Business must combine. These are called PROXYS
We  have ProxyFactoryBean
è ProxyFactoryBean p = new ProxyfactoryBean();
è p.setTarget(BusinessObj)
è p/setInterceptorNmaes(services[])
è BankProxy bp = pb.getObject() àChild class of Business Object

·         StaticMathodMatcherPointcut
·         NamematchMathodPointcut

3.       Advicers