我们可以使用AWS API Gateway使用Feign客户端吗?
我们使用AWS API网关管理了几个微服务,这也充当负载平衡器。我们尚未集成弹簧云和尤里卡服务来执行负载平衡并调用外部服务调用。
仅仅因为不编写单位测试用例而替换reteptemplate是有意义的吗?
We have a couple of microservices managed using AWS API Gateway which also acts as a load balancer. We have not integrated spring cloud and eureka services to perform load balancing and invoke external service calls.
Does it make sense to replace RestTemplate with feign-client only for not writing unit test cases?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定这与单元测试有何关系,但是您可以使用Spring Cloud OpenFeign替换
RESTTEMPLATE
,以获得更精简,更可读的API。它还可以在引擎盖下为您处理客户端的负载平衡。但是,您可能希望等到Spring 6版本,然后切换到新的 Spring Interface Client 。Not sure how this is related to unit tests, but you can replace
RestTemplate
with Spring Cloud OpenFeign for a leaner, more readable API. It may also handle client-side load-balancing for you under the hood. However, you might wish to wait till Spring 6 release and switch to using the new Spring interface client instead.我们可以不使用Eureka服务器和配置客户端使用Feign Client。假装客户端位于其余模板的顶部。
因此,在两个微服务端客户端之间有更好的互通功能正常。
您需要做的就是为feign Client @feignclient提供其他参数以及名称param
端口需要是固定端口,并且不能由Spring Boot随机提供。因此用户服务器端口
application.yml
We can use feign client without using the eureka server and config client. Feign client sits on top of the rest template.
So for better intercommunication between two microservices feign client works fine.
All you need to do is to supply additional parameter for url to the feign client @FeignClient along with name param
The port needs to be a fixed port and cannot be randomized provided by spring boot. So user server port
application.yml