Results 1 to 6 of 6

Thread: AOP implementation

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    4

    Default AOP implementation

    Hi,

    Thank you Spring team for the great work. I am really diggin your code. I am relatively new to AOP. I follow your implementation in aop package up to the point of getting all the bean, advices and interceptors in bean container like ProxyBeanFactory. However, I do not see how the interceptors and advise get applied. And how the MethodInvocation is linked to PointCut. Can anyone clarify the flow how things are tied up together? And Rod, would you be writing a book about AOP implementation? I will be among the first to buy. Thanks.


    Don B.

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Don

    The interceptor chain is applied by either JdkDynamicAopProxy (for J2SE dynamic proxies) or Cglib2AopProxy, both in the org.springframework.aop.framework package. This proxy is configured by the AdvisedSupport object it refers to, which supplies the advice chain etc. (ProxyFactory and ProxyFactoryBean extend AdvisedSupport).

    A MethodInvocation object flows through the interceptor chain, with the pointcut being evaluated for each piece of advice. An Advisor contains both pointcut and advice. (An advice is an object that can execute if the pointcut fires. An Interceptor is an example of an advice.)

    There's some optimization in that pointcuts can often be evaluated just once, when the proxy is created, but this is the basic concept.

    There's a fairly detailed chapter about AOP in "J2EE without EJB". I'm also writing a very detailed AOP chapter for the forthcoming "Professional Spring Development".

    Rgds
    Rod

  3. #3
    Join Date
    Aug 2004
    Posts
    4

    Default

    Thank you for your reply, Rod. I will take a closer look at the code and follow your explanation. I have your first book and the J2EE without EJB is on its way. Really great work. I would like to thank you as many times as you can take. No joke.

  4. #4
    Join Date
    Aug 2004
    Location
    India
    Posts
    16

    Default

    Hi Rod,
    Quote Originally Posted by Rod Johnson
    Don

    The interceptor chain is applied by either JdkDynamicAopProxy (for J2SE dynamic proxies) or Cglib2AopProxy, both in the org.springframework.aop.framework package. This proxy is configured by the AdvisedSupport object it refers to, which supplies the advice chain etc. (ProxyFactory and ProxyFactoryBean extend AdvisedSupport).

    A MethodInvocation object flows through the interceptor chain, with the pointcut being evaluated for each piece of advice. An Advisor contains both pointcut and advice. (An advice is an object that can execute if the pointcut fires.
    As per your statement then the Advisor in Spring should have the PointCut also , but your design have a seperate Pointcut Advisor and Introduction Advisor ? Why is this like that ?

    Regards
    Vicky

  5. #5
    Join Date
    Aug 2004
    Location
    India
    Posts
    16

    Default

    As per your statement then the Advisor in Spring should have the PointCut also , but your design have a seperate Pointcut Advisor and Introduction Advisor ? Why is this like that ?
    Rod ,
    Can I get some of your time on this . :wink:
    Regards
    Vicky

  6. #6
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    As per your statement then the Advisor in Spring should have the PointCut also , but your design have a seperate Pointcut Advisor and Introduction Advisor ? Why is this like that?
    There are two types of Advisor: those for applying an advice to methods (the commonest case), and those for making introductions to advised objects. The first type is PointcutAdvisor: a Pointcut is required to identify which methods to advice. The second type is IntroductionAdvisor: the MethodMatcher part of the Pointcut interface is irrelevant in this case, hence we only use the ClassFilter part rather than a whole Pointcut.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Overload a bean implementation
    By belaran in forum Web Flow
    Replies: 3
    Last Post: Aug 8th, 2005, 04:31 AM
  2. Replies: 2
    Last Post: May 4th, 2005, 10:39 PM
  3. Other Hibernate DAO LazyInitializationExceptions
    By bernardsirius in forum Data
    Replies: 5
    Last Post: Feb 18th, 2005, 04:09 PM
  4. Replies: 9
    Last Post: Feb 8th, 2005, 09:25 PM
  5. Replies: 4
    Last Post: Nov 16th, 2004, 02:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •