Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring AOP AroundAdvice

 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have an question, in around advice invoke() function returntype object, what is the use of that object, this object we get after proceed() function. like in my code below.


Please first tell me what is the use of ob and how can i use it or can retrieve it my logic file.

Thanks.
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The object depends on the return value of the join point.
If you don't call proceed(), the advised join point is bypassed. proceed() causes the execution of the advised join point, and it will return the same value returned by the advised join point. For example, if you are advising a method that returns a Person object, invoking proceed() will return the same Person object as the advised method.

So in the method you have you would do some stuff before the method was invoked, then you will call proceed(). At that point you have the result of the invocation of the advised method (the object). Now you can do some stuff after the method has been executed optionally using the return value. Once you return the object the original caller will get the result (object)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic