public class FeignInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (requestAttributes == null){
return;
}
HttpServletRequest httpServletRequest = requestAttributes.getRequest();
//设置tokenid
requestTemplate.header("tokenId",httpServletRequest.getHeader("tokenId"));


/**
* 网关或者线程池内有时候没有request
* 如果使用线程池:RequestContextHolder.setRequestAttributes(RequestContextHolder.getRequestAttributes(), true);
*/

}



}