aspose file tools
The moose likes Spring and the fly likes Dout in Around Advice Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "Dout in Around Advice" Watch "Dout in Around Advice" New topic
Author

Dout in Around Advice

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 202


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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17231
    
    1

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

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Dout in Around Advice
 
Similar Threads
Problem with Spring AOP
AOP in Apring 2.5 - Declare Aspects with AspectJ annotations
Spring AOP with mvc
Execption in AOP Logging Program Issue
AOP Not working with Spring 3 MVC application