Spring Cloud Feign简介
Spring Cloud官方原文:
A central concept in Spring Cloud’s Feign support is that of the named client. Each feign client is part of an ensemble of components that work together to contact a remote server on demand, and the ensemble has a name that you give it as an application developer using the
@FeignClientannotation. Spring Cloud creates a new ensemble as anApplicationContexton demand for each named client usingFeignClientsConfiguration. This contains (amongst other things) anfeign.Decoder, afeign.Encoder, and afeign.Contract.Spring Cloud lets you take full control of the feign client by declaring additional configuration (on top of the
FeignClientsConfiguration) using@FeignClient.
翻译:
Spring Cloud的Feign支持中的一个中心概念是命名的客户端。 每个feign客户端都是组件的一部分,这些组件是按需联系远程服务器的组件的一部分,并且集合有一个名称,您可以使用@FeignClient注释将其作为应用程序开发人员提供。 Spring Cloud使用FeignClientsConfiguration创建一个新的集合,作为每个指定客户端的ApplicationContext。 这包含(其中包括)feign.Decoder,feign.Encoder和feign.Contract。
通过使用@FeignClient声明额外的配置(在FeignClientsConfiguration之上),Spring Cloud可让您完全控制Feign客户端。
覆盖Feign的默认配置
定义Feign客户端接口
@FeignClient(name = "microservice-springcloud-user",configuration = MyConfiguration.class)
public

本文介绍了如何覆盖Spring Cloud Feign的默认配置,包括定义Feign客户端接口、自定义FeignClientsConfiguration,以及如何进行Feign日志配置,如设置日志级别和记录内容,并提供了配置示例和测试说明。

5376

被折叠的 条评论
为什么被折叠?



