Feign
spring cloud
# 常用操作
# Feign接口调用如何获取响应头
@RestController
public class TestController {
@Autowired
private ReciveClient reciveClient;
@GetMapping("/request")
public void request() {
Response response = reciveClient.recive();
System.out.println(response.headers());
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
@RestController
public class ReciveController {
@GetMapping("/recive")
public String recive() {
return "hello world";
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7
@FeignClient
public interface ReciveClient {
@GetMapping("/recive")
public Response recive();
}
1
2
3
4
5
2
3
4
5
参考:
https://stackoverflow.com/questions/38742191/get-headers-feign-netflix (opens new window)
# 输出日志
logging:
level:
com.xxx.feign.xxxFeignClient: debug
feign:
client:
config:
default:
loggerLevel: full
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9