I am using spring AOP for method profiler. I want method logging for all the methods, even if the method is called from the same class. So, I use AopContext.currentProxy()
to call method. It's working as expected. But, I can't rewrite all method calls, so, I want any alternate solutions, any xml approach, or any other approach, so that every method is called using aop proxy bean.
Asked
Active
Viewed 379 times
1
1 Answers
0
If you use AspectJ instead of Spring AOP the aspect will be applied even if you are calling the method from the same class. Keep in mind this won't make every method call be invoked through a proxy as you request in your question, but rather change the way AOP is implemented so that proxies are not needed.
Check this question on the differences between AspectJ and Spring AOP.
Here is the documentation on how you can implement a solution using AspectJ.

jspurim
- 925
- 8
- 25
-
I implemented AspectJ. But still not solved the problem. Please give some different solutions. It also not working for nested method calls. – Aakash Jun 22 '17 at 14:57
-
Could you please post what your current configuration looks like? Even better, provide an [MCVE](https://stackoverflow.com/help/mcve). – jspurim Jun 22 '17 at 15:27