How to instrument java methods?

前端 未结 5 696
不思量自难忘°
不思量自难忘° 2020-12-09 22:15

I want to write a simple java agent which can print the name of a method called by the java program instrumented.

For example, my java program I want to instrument

5条回答
  •  长情又很酷
    2020-12-09 22:55

    If your need is simply to record a method was called or not, then aspect-oriented programming is exact what you need, no matter AspectJ(static) or Spring AOP(dynamic), both provide powerful capability to do that. However you may need some instrument libraries in case you want to do more instrument stuff, such like track the execution time, calling track. Hope it helps.

提交回复
热议问题