Ribbon之IClientConfig、IClientConfigKey

发布时间:2020-06-17 20:53:54 作者:乾坤刀
来源:网络 阅读:7307

参考地址:http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#spring-cloud-ribbon

它主要的作用就是装载配置信息,用于初始化客户端和负载均衡器。默认的实现方式是DefaultClientConfigImpl。

public <T> IClientConfig set(IClientConfigKey<T> key, T value);

public <T> T get(IClientConfigKey<T> key, T defaultValue);

它是通过Archaius加载ClientConfig. 配置参数可以通过配置文件或system properties。也可以通过编程的方式实现IClientConfig的加载。

配置文件的配置参数格式:

<clientName>.<nameSpace>.<propertyName>=<value>

clientName正对某个服务的服务名称,如:user。

nameSpace是命名空间,默认是ribbon.

如果没有clientName,则是对所有的client都有效。如:

ribbon.ReadTimeout=1000

默认clientConfig,参数:

Ribbon之IClientConfig、IClientConfigKey

通过CommonClientConfigKey加载对应的参数类型:

Ribbon之IClientConfig、IClientConfigKey

它的作用就是定义各种参数以及对应类型。实现特点:自包含定义常量类。

Ribbon之IClientConfig、IClientConfigKey









推荐阅读:
  1. SpringCloud之Ribbon
  2. Ribbon之ILoadBalancer

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

springcloud ribbon iclientconfig

上一篇:c/c++编译器的安装

下一篇:seconds_behind_master问题分析一则

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》