com.suchtool.nicelog.aspect.impl.feign.FeignLogRequestInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nicelog-spring-boot-starter Show documentation
Show all versions of nicelog-spring-boot-starter Show documentation
collect log automatically for SpringBoot project
The newest version!
package com.suchtool.nicelog.aspect.impl.feign;
import com.suchtool.nicelog.property.NiceLogProperty;
import com.suchtool.nicelog.util.NiceLogTraceIdUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
public class FeignLogRequestInterceptor implements RequestInterceptor, Ordered {
@Autowired
private NiceLogProperty niceLogProperty;
private final int order;
public FeignLogRequestInterceptor(int order) {
this.order = order;
}
@Override
public void apply(RequestTemplate requestTemplate) {
requestTemplate.header(
niceLogProperty.getFeignTraceIdHeader(),
NiceLogTraceIdUtil.readTraceId());
}
@Override
public int getOrder() {
return order;
}
}