关于Ribbon和Feign两种配置方式优先级问题

来源:7-8 配置最佳实践总结

zengchen

2019-08-13

测试的结果是
Ribbon,属性配置方式比代码配置方式要低,跟老师你讲的不一样
Feign,属性配置方式比代码配置方式要高,这个结果和老师一样

写回答

1回答

大目

2019-08-13

您好,应该是您测试有问题哈:

Ribbon的属性配置比代码配置优先级高。官方文档也有写:

https://cloud.spring.io/spring-cloud-static/Greenwich.SR1/single/spring-cloud.html#_customizing_the_ribbon_client_by_setting_properties


Classes defined in these properties have precedence over beans defined by using @RibbonClient(configuration=MyRibbonConfig.class) and the defaults provided by Spring Cloud Netflix.

   


0
5
zengchen
回复
大目
单用一种配置,都是生效的,两种都开,结果就是代码配置
2019-08-13
共5条回复

Spring Cloud Alibaba微服务从入门到进阶

面向未来微服务:熟练掌握Spring Cloud Alibaba

3085 学习 · 1324 问题

查看课程