mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 12:19:27 +08:00
⚡ 修复feign请求头传递问题
This commit is contained in:
parent
9252f24ff0
commit
bb3d735c34
@ -18,7 +18,9 @@ package org.springblade.core.cloud.config;
|
|||||||
import com.alibaba.cloud.sentinel.feign.SentinelFeignAutoConfiguration;
|
import com.alibaba.cloud.sentinel.feign.SentinelFeignAutoConfiguration;
|
||||||
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
|
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
|
||||||
import feign.Feign;
|
import feign.Feign;
|
||||||
|
import feign.RequestInterceptor;
|
||||||
import org.springblade.core.cloud.feign.BladeFeignSentinel;
|
import org.springblade.core.cloud.feign.BladeFeignSentinel;
|
||||||
|
import org.springblade.core.cloud.header.BladeFeignRequestHeaderInterceptor;
|
||||||
import org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler;
|
import org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
@ -41,8 +43,8 @@ public class BladeCloudAutoConfiguration {
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
@ConditionalOnProperty(name = "feign.sentinel.enabled")
|
@ConditionalOnProperty(name = "feign.sentinel.enabled")
|
||||||
public Feign.Builder feignSentinelBuilder() {
|
public Feign.Builder feignSentinelBuilder(RequestInterceptor requestInterceptor) {
|
||||||
return BladeFeignSentinel.builder();
|
return BladeFeignSentinel.builder().requestInterceptor(requestInterceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ -51,4 +53,10 @@ public class BladeCloudAutoConfiguration {
|
|||||||
return new BladeBlockExceptionHandler();
|
return new BladeBlockExceptionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public RequestInterceptor requestInterceptor() {
|
||||||
|
return new BladeFeignRequestHeaderInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user