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