Meaningless Drivel is fun!
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: 215

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: 17271

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 - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Dout in Around Advice
It's not a secret anymore!