|
@@ -10,6 +10,8 @@ import java.util.Map;
|
|
|
|
|
|
//@LoadBalancerClient(name = "service-provider-demo",
|
|
|
// configuration = NacosLoadBalancerConfig.class)
|
|
|
+// 不走通用的配置 单独指定配置
|
|
|
+//@FeignClient(value = "service-provider-demo",configuration = FeignOtherConfig.class)
|
|
|
@FeignClient("service-provider-demo")
|
|
|
public interface MyProviderClient {
|
|
|
|
|
@@ -40,14 +42,14 @@ public interface MyProviderClient {
|
|
|
|
|
|
// 第二种解决方案是
|
|
|
@GetMapping("/testMultiParam")
|
|
|
- String testMultiParam(@RequestParam Map<String,Object> map);
|
|
|
+ String testMultiParam(@RequestParam Map<String, Object> map);
|
|
|
|
|
|
@PostMapping("/postUser")
|
|
|
String postUser(@RequestBody UserDto user);
|
|
|
|
|
|
// 通过openFeign调用其他微服务时 怎么携带请求头
|
|
|
// 第一种 直接写在方法的注解中
|
|
|
- @GetMapping(value = "/token",headers = {"token=123456"})
|
|
|
+ @GetMapping(value = "/token", headers = {"token=123456"})
|
|
|
String token();
|
|
|
|
|
|
// 第二种 方法入参中使用@RequestHeader
|
|
@@ -57,4 +59,8 @@ public interface MyProviderClient {
|
|
|
// 第三种 使用Feign拦截器
|
|
|
@GetMapping("/token")
|
|
|
String tokenByInterceptor();
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/timeout")
|
|
|
+ String timeout();
|
|
|
}
|