在我的新任务中,我需要了解中级Java应用程序。为了更快地理解流程,我有这样的想法,如果我能够在运行时看到函数被调用,哪个函数最终响应,那么我真的可以在我的脑海中获得整个地图。
我使用过像AppDynamics这样的工具来告诉延迟/数据库调用等。但是我正在寻找的东西会告诉我运行时的流程。喜欢,
Controller.getStudent() -> Service.getStudent() -> Repository.getStudent() -> ....
我想知道是否有任何工具/技术。就像在调试模式下记录堆栈跟踪一样。我可以想象一个工具做Thread.currentThread().getStackTrace()
。有没有人对如何做到这一点有所了解? (我正在使用Springboot和Jboss)
编辑:我不是真正关注日志记录,调试等等。我觉得可能有些东西可以告诉我们正在执行哪些功能。并确定是否有任何限制。
@Aspect
@Component
public class FunctionTraceAspect {
@Before("execution(* some.package.*.*.*(..))")
public void appendUserContext(JoinPoint joinPoint) {
System.out.println("TRACE: " + joinPoint.getSignature());
}
}