Hello,
I just wonder how can i get the returning object if it has?
e.g
public User update(User user)
{
..................
return user;
}
how can i get the the user object in the after advice?
any idea?
thanks.
cheers.
Hello,
I just wonder how can i get the returning object if it has?
e.g
public User update(User user)
{
..................
return user;
}
how can i get the the user object in the after advice?
any idea?
thanks.
cheers.
You can use after returning advice or around advice. See http://static.springsource.org/sprin...rence/aop.html section 6.2.4.2.
Here is the example provided on how to capture the return value. Of course it is much cleaner if you were to use code style advice.
Code:import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.AfterReturning; @Aspect public class AfterReturningExample { @AfterReturning( pointcut="com.xyz.myapp.SystemArchitecture.dataAccessOperation()", returning="retVal") public void doAccessCheck(Object retVal) { // ... } }
Andrew Eisenberg, Ph.D.
SpringSource, a division of VMware
SpringSource Tools Team
More about AJDT, Groovy-Eclipse, and Grails tooling