我继承了一个旧版Spring3应用程序,我正在尝试向其中添加Lightstep工具。我在转换此处手动配置的说明时遇到麻烦。https://github.com/opentracing-contrib/java-spring-web
简而言之,我需要将下面的代码块转换为等效的xml。
@Configuration
@Import({TracingHandlerInterceptor.class})
public class MVCConfiguration extends WebMvcConfigurerAdapter {
@Autowired
private Tracer tracer;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TracingHandlerInterceptor(tracer));
}
@Bean
public FilterRegistrationBean tracingFilter() {
TracingFilter tracingFilter = new TracingFilter(tracer);
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(tracingFilter);
filterRegistrationBean.addUrlPatterns("/*");
filterRegistrationBean.setOrder(Integer.MIN_VALUE);
filterRegistrationBean.setAsyncSupported(true);
return filterRegistrationBean;
}
}
我已经使用以下依赖关系成功创建了我的Lightstep Tracer bean。
compile group: 'com.lightstep.tracer', name: 'lightstep-tracer-jre', version: '0.14.8'
compile group: 'com.lightstep.tracer', name: 'tracer-okhttp', version: '0.15.10'
//https://mvnrepository.com/artifact/io.opentracing.contrib/opentracing-spring-web-starter
compile group: 'io.opentracing.contrib', name: 'opentracing-spring-web-starter', version: '0.3.3'