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

cn.flood.cloud.seata.rest.SeataRestTemplateInterceptor Maven / Gradle / Ivy

There is a newer version: 2.7.14.0
Show newest version
package cn.flood.cloud.seata.rest;

import cn.flood.base.core.Func;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import io.seata.core.context.RootContext;

/**
 * @author mmdai
 * @version 1.0
 * @date 2022/4/20 12:36
 */
public class SeataRestTemplateInterceptor implements RequestInterceptor {

  @Override
  public void apply(RequestTemplate requestTemplate) {
    String xid = RootContext.getXID();
    if (Func.isNotEmpty(xid)) {
      requestTemplate.header(RootContext.KEY_XID, xid);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy