SpringCloud系列之使用Feign进行服务调用
在 上一章 的学习中,我们知道了微服务的基本概念,知道怎么基于Ribbon+restTemplate的方式实现服务调用,接着上篇博客,我们学习怎么基于Feign实现服务调用,请先学习上篇博客,然后再学习本篇博客 Feign是一个声明式的web service客户端,它使得编写web service客户端更为容易。创建接口,为接口添加注解,即可使用Feign。Feign可以使用Feign注解或者JAX-RS注解,还支持热插拔的编码器和解码器。 环境准备: JDK 1.8 SpringBoot2.2.1 SpringCloud(Hoxton.SR6) Maven 3.2+ 开发工具 IntelliJ IDEA smartGit 创建一个SpringBoot Initialize项目,详情可以参考我之前博客: SpringBoot系列之快速创建项目教程 port: 8083 spring: application: name: feign-service-consumer eureka: client: service-url: defaultZone: http://localhost:8761/eureka/ healthcheck: enabled: false instance: status-page-url-path: http://localhost:8761