• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Help Needed in AOP

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to learn AOP in Spring framework for the past so many days but of no avail. I also tried to run a sample code but it did not work. Please if anyone can help me in understanding Spring's AOP both practically and theoretically.
[ January 17, 2008: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You Know what, Get yourself a book. I would recommend Spring in Action 2. The author explained AOP very well and there are sample codes in the chapter
 
Ranch Hand
Posts: 62
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
AOP topic is a bit different, its voculabory is new,
so you will read,re-read and understand AOP slowly.

But the most simple case which can help you understand AOP is
1>You have a method in a class,whose code you cannot alter,
You want some custom code to run either at very start or at end or want to handle exception from original code or best to avoid the original method call itself,based on some conditions.A proxy object with new and old code gets created which actually handles method execution.

thanks
Vilpesh
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have got Spring in Action book only. I have read AOP from it but i am not able to understand from it. I am not able to understand why we use proxyinterfaces. What is the concept of proxy interfaces. ??? Basically I do understand why we are using AOP but not able to understand how we are implementing it in Spring or how we are implementing it practically. If anybody can help me understand the concepts practically then it would be of great help. Thanks in advance.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I check Spring In Action yesterday night, and I found it easy enough to understand. As Vilpesh said, there's a lot of new vocabulary where you're attacking AOP for the first time. I'd suggest you to reread the AOP chapter from the beginning, slowly, and focusing on important words like Advice, Pointcut, Proxy...

What is the concept of proxy interfaces. ???


Just think of a proxy as something that acts like your bean, with some extra functionality. Look at the following :

You can ask spring to give you an instance of MyBean, with a <bean> tag, or you can ask Spring to give you a proxy of that bean, using the same interface.

Here, you're still working on a MyInterface instance, but this time, it's a proxy of your bean. Your bean does not have a clue about AOP, but the proxy does.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well now i have understood about proxy and its code....... but now what i am not able to understand is why are we using proxy exactly.... why not use the original bean in the first place.... another thing what is the concept of target here........ please help me clarify my concepts........... thanks in advance....
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Siddharth,
Proxy Bean is kind of virtual Bean,
where we actually map advice for particular target Functionality.

There are basically 3 parts while creating proxy bean,
1. proxyInterfaces : which is interface implemented by target bean.
2. interceptorNames : which states which advices are to apply on target bean.
3. target : which is target bean on which we need to apply advices.

kindly go through following sample, which might help you to understand in better way.
http://spring.javabeat.net/articles/2007/07/introduction-to-spring-aspect-oriented-programming-aop/4

many thanks,
Amol Juvatkar
 
Your mother was a hamster and your father was a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic