1.其中最简单的方法就是直接在请求中加上 注解@@RequestHeader 来进行实现
@FeignClient(contextId = "remoteNameService", value = "test" , fallbackFactory = RemoteNameFallbackFactory.class)
public interface RemoteNameService {
/***
* 获取名称
* @return
*/
@GetMapping("/approvalForm/getApprovalForm")
public String getApprovalForm(@RequestParam(name = "type",defaultValue = "") Integer type,@RequestHeader(name = "Token",required = true) String Token);
}
2.就是在@FeignClient 注解中加入配置类 他需要在配置文件yml 文件中加上如下代码
hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE
然后需要配置文件 FeignConfiguration
import com.alibaba.fastjson.JSONObject;
import com.dfhm.common.core.utils.StringUtils;
import feign.RequestInterceptor;
import feign.