|
@@ -0,0 +1,24 @@
|
|
|
+package com.persagy.apm.report.common.config;
|
|
|
+
|
|
|
+import feign.RequestInterceptor;
|
|
|
+import feign.RequestTemplate;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 自动为feign请求header加上租户标识的拦截器
|
|
|
+ *
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2022/4/23 19:31
|
|
|
+ **/
|
|
|
+@Configuration
|
|
|
+public class FeignRequestHeaderInterceptor implements RequestInterceptor {
|
|
|
+
|
|
|
+ @Value("${defaultGroupCode:YL}")
|
|
|
+ private String defaultGroupCode;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void apply(RequestTemplate template) {
|
|
|
+ template.header("groupCode", defaultGroupCode);
|
|
|
+ }
|
|
|
+}
|