File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Aspect Oriented Programming and the fly likes Spring AOP AroundAdvice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Aspect Oriented Programming
Bookmark "Spring AOP AroundAdvice" Watch "Spring AOP AroundAdvice" New topic

Spring AOP AroundAdvice

vivek dhiman
Ranch Hand

Joined: Aug 05, 2011
Posts: 151


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.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

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)

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Spring AOP AroundAdvice
It's not a secret anymore!