版本 spring boot、spring cloud、ribbon 不工作 [英] Versions spring boot, spring cloud, ribbon not working
问题描述
目前我正在学习如何使用 spring boot 和 spring cloud 工作微服务,现在我在选择 spring cloud 和启动版本时遇到了很多问题,我还没有使用 @RibbonClient 注释,因为我还没有找到依赖项.
currently i am learning how working microservices using spring boot and spring cloud, now i am having many problems to chose the spring cloud and boot versions, i have not got to use the @RibbonClient anotation because i have not found the dependency.
我想使用最新版本的spring cloud和spring boot,但是我没有找到ribbon依赖.我想使用 spring boot 2.4.1 和 spring cloud 2.20.0.x
i want to use the latest versions of spring cloud and spring boot, but i don't found the ribbon dependency. I want to use spring boot 2.4.1 and spring cloud 2.20.0.x
实际上我做了一个简单的项目,有 3 个项目(项目、产品、模型),模型 项目有 common 模型 和假客户和其他项目(项目,产品)有一个模型项目作为依赖.
Actually i have made a simple project with 3 project(item,products,models), the model project has the common models and the the feign clients, and the others projects(item,products) have a model project as dependency.
模型项目
[![modelProject][1]][1]
[![modelProject][1]][1]
[![feignClient][2]][2]
[![feignClient][2]][2]
[![Ribbon][3]][3]
[![Ribbon][3]][3]
[![pom.xml][4]][4][![pom.xml2][5]][5][![pom.xml3][6]][6]
[![pom.xml][4]][4] [![pom.xml2][5]][5] [![pom.xml3][6]][6]
产品项目
这个项目只有一个控制器、服务和存储库
this project just has a controller, service and repository
[![产品项目][7]][7]
[![Products project][7]][7]
项目项目
这个项目只有一个控制器,它向产品控制器发出请求
this project just has a controller which makes a request to products controller
[![ItemProject][8]][8]
[![ItemProject][8]][8]
现在我想在 model.properties 中添加 products.ribbon.listOfServers=localhost:8001,localhost:9001 所以,但我没有得到那个功能区.
Now i want add at the model.properties the products.ribbon.listOfServers=localhost:8001,localhost:9001 so, but i don't got that ribbon works.
谢谢,对不起,我的英语不是我的母语[1]:https://i.stack.imgur.com/CnPxN.png[2]:https://i.stack.imgur.com/Sb26S.png[3]:https://i.stack.imgur.com/RFy0i.png[4]:https://i.stack.imgur.com/SaDhs.png[5]:https://i.stack.imgur.com/S6Rjl.png[6]:https://i.stack.imgur.com/aSo1m.png[7]:https://i.stack.imgur.com/SIyd5.png[8]:https://i.stack.imgur.com/58YuK.png
Thanks, and sorry for my english, is not my native languaje [1]: https://i.stack.imgur.com/CnPxN.png [2]: https://i.stack.imgur.com/Sb26S.png [3]: https://i.stack.imgur.com/RFy0i.png [4]: https://i.stack.imgur.com/SaDhs.png [5]: https://i.stack.imgur.com/S6Rjl.png [6]: https://i.stack.imgur.com/aSo1m.png [7]: https://i.stack.imgur.com/SIyd5.png [8]: https://i.stack.imgur.com/58YuK.png
推荐答案
Spring Cloud Netflix Ribbon 已被弃用,未包含在 2020.0.0
版本系列中.Spring Cloud LoadBalancer 是建议的替代方案.你可以阅读它的文档这里.您可以按照简单指南此处查看更强大的示例
Spring Cloud Netflix Ribbon has been deprecated and is not included in the 2020.0.0
release train. Spring Cloud LoadBalancer is the suggested alternative. You can read its docs here. You can follow a simple guide here and see a more robust sample here.
这篇关于版本 spring boot、spring cloud、ribbon 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!