File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Dout in Around Advice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Dout in Around Advice" Watch "Dout in Around Advice" New topic

Dout in Around Advice

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 224

Code containing the Aspect

Bean on which Aspect will be applied

After Running the above program i get the output as :

After removing the comment from last method from class Asp i get the output as:

Q1) I am not able to understand second output? why DEF and Hello world is not getting printed?

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Because with an Around type advice. You are required to call the target method. You do that by the following

Without the call to proceed() the other objects won't get called. Also in Around if the target method returns an object, you have to return it from the Around method, otherwise the client will always get null. Around is the most powerful advice type, but with power comes great responsibility. Have fun


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Dout in Around Advice
It's not a secret anymore!