Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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

Win a copy of The Software Craftsman this week in the Agile forum!
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: 17260

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Dout in Around Advice