我有这种情况。方法 A 是异步的,它使用方法 B 和 C,它们也是异步的。Spring 使用 @Async 注释来声明该方法必须在新线程中运行。
我在方法 A 中使用了 @Trace 注释。我还想跟踪方法 B 和 C,而不在每个方法上使用 @Trace(dispatcher = true)。可能吗?
跟踪注释有很多标志,但我无法使其工作。
@Trace(dispatcher = true)
@Async
public void methodA(){
methodB();
methodC();
}
@Async
public void methodB(){ //I don't want another @Trace annotation here
//some code
}