Spring cloud feign example explanation and learning

The previous blog has built an Eureka + ribbon + hystrix framework. Although it can basically meet the calls between services, the code looks really ugly. Every time the client has to write a resttemplate. In order to make the calls more beautiful and readable, now we begin to learn to use feign.

Feign includes ribbon and hystrix, which gradually realized its significance in practice. The so-called inclusion is not the physical inclusion that feign's jar package contains ribbon and hystrix's jar package, but the logical inclusion that feign's functions include the functions of the other two. In short: feign is capable of ribbon and hystrix, but to use the annotations provided by ribbon and hystrix, you must introduce the corresponding jar package.

Case 1:

Eureka registry: https://github.com/yejingtao/forblog/tree/master/demo-eureka-register

Service provider: https://github.com/yejingtao/forblog/tree/master/demo-feign-freeservice

Service Caller: https://github.com/yejingtao/forblog/tree/master/demo-feign-freeconsumer

Eureka registry: https://github.com/yejingtao/forblog/tree/master/demo-eureka-register

Interface API: https://github.com/yejingtao/forblog/tree/master/demo-feign-serviceapi

Service provider: https://github.com/yejingtao/forblog/tree/master/demo-feign-serviceimpl

Service Caller: https://github.com/yejingtao/forblog/tree/master/demo-feign-apiconsumer

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>