How to capture the parameters of System.out.println() in AspectJ's aspect and display in pointcut?

為{幸葍}努か 提交于 2019-12-02 01:21:48
SachiN Ware.

I was shocked still .. 2 days after posting,no one answered my this question... but its fine i have found a solution and realized where i was wrong. it was the mistake in my signature of println method().

This is the correct signature of println:

 void around(String str) : 
    call(void java.io.PrintStream.println(String)) && args(str)

and it worked fine for me . .

catch of method calls from JRE is not so easy.

is easier to learn aspectj when you try to catch your own methods. Define your own println method perhaps in HelloClass and try again.

for work with aspectj and jre classes you need to recompile jre classes with aspectj compiler.

http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg09350.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!