2

我继承了一个遗留的 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'
4

0 回答 0