Spring AOP Proxy Self Access

 While reading "AspectJ In Action, 2nd Ed", I ran across the following method of accessing an advised aop proxy from within the proxied class while still activating the aspect functionality:

 

AopContext.currentProxy()

 

 

That's it. Barely worth a post, I know, but may come as great help if you ever used Spring's AOP Wrapping (transactions, caching, ...) and needed to make a self-bound call that should go through the AOP interceptors.



Share this article: