Spring boot 如何使用勇敢的追踪打印traceId和spanId?

Spring boot 如何使用勇敢的追踪打印traceId和spanId?,spring-boot,trace,spring-cloud-sleuth,Spring Boot,Trace,Spring Cloud Sleuth,之前我用spring boot 1.5.12编写了以下代码:- import org.springframework.cloud.sleuth.Span; import org.springframework.cloud.sleuth.Tracer; @Autowired Tracer tracer; Span span = this.tracer.getCurrentSpan(); System.out.println(Span.idToHex(span.getS

之前我用spring boot 1.5.12编写了以下代码:-

 import org.springframework.cloud.sleuth.Span;

 import org.springframework.cloud.sleuth.Tracer;

@Autowired
Tracer tracer;



    Span span = this.tracer.getCurrentSpan();
    System.out.println(Span.idToHex(span.getSpanId()));
    System.out.println(Span.idToHex(span.getTraceId()));
但此代码不适用于spring boot 2.2.6。我现在应该如何打印?

import-brave.Tracer;
导入lombok.extern.slf4j.slf4j;
导入org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.stereotype.Component;
@Slf4j
@组成部分
公共类打印机{
@自动连线
私人示踪剂;
公开作废印刷品(){
var span=this.tracer.currentSpan();
System.out.println(span.context().traceIdString());
System.out.println(span.context().spanIdString());
}
}