@Configuration
public class FeignAcceptHeaderConfig implements RequestInterceptor {

    static ThreadLocal<Map<String, String>> headerLocal = new ThreadLocal<Map<String, String>>();

    @Override
    public void apply(RequestTemplate template) {
        Map<String, String> map = headerLocal.get();
        if (map != null) {
            Set<String> strings = map.keySet();
            for (String key : strings) {
                template.header(key, map.get(key));
            }
        }
    }

    public static void setHeaderLocal(Map<String, String> headers) {
        headerLocal.set(headers);
    }

    public static void rmHeaderLocal() {
        headerLocal.remove();
    }
}