All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lwq.fast.log.trace.interceptor.TraceFeignInterceptor Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
package com.lwq.fast.log.trace.interceptor;

import com.lwq.fast.log.fastlogcore.constant.Constants;
import com.lwq.fast.log.fastlogcore.trace.TraceThreadLocal;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * @author 刘文强
 *
 * 支持feign调用时,trace放入header
 */
@Configuration
@Order(1)
public class TraceFeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        String traceId = TraceThreadLocal.get();
        requestTemplate.header(Constants.TRACE_ID,traceId);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy