SpringCloud Feign 服务之间的请求
对Spring Cloud Ribbon和Spring Cloud Hystrix在实践过程中,这两个框架的使用几乎是同时出现的,Spring Cloud Feign就是一个更高层次的封装来整合这两个基础工具以简化开发。它基于Netflix Feign实现,除了提供这两者的强大功能之外,它还提供了一种声明式的Web服务客户端定义的方式。Spring Cloud Feign在RestTemplate的封装基础上做了进一步封装,由它来帮助定义和实现依赖服务接口的定义,在Spring Cloud Feign的实现下,只需创建一个接口并用注解的方式来配置它,即可完成对服务提供方接口的绑定。Spring Cloud Feign具备可插拔的注解支持,包括Feign注解和JAX-RS注解,为了适应Spring用户,它在Netflix Feign基础上扩展了对Spring MVC注解的支持。 1. 快速集成 Spring Cloud Feign 基础服务搭建 eureka-server工程:服务注册中心 hello-service工程:服务提供者 Spring Cloud Feign Client服务搭建 创建Spring Boot 工程 feign-consumer 添加依赖: spring-cloud-starter-eureka-server, spring-cloud-starter