Feign原理分析记录

coder / 2023-07-29 / 原文

背景:使用feign将参数封装为对象后,只能发post请求了,困惑了很久,所以有必要了解一下feign原理

一、Feign、OpenFeign、Spring Cloud Feign发布历史

1.1 Feign

  Netflix开源的一个组件,maven中央库看到最新的更新时间

  中央库地址:https://mvnrepository.com/artifact/com.netflix.feign/feign-core

  • 2013年6月 Netflix Feign 第一个版本:1.0.0
  • 2016年 7月 Netflix Feign 最后一个版本:8.18

1.2 OpenFeign

  中央库:https://mvnrepository.com/artifact/io.github.openfeign/feign-core

  • 2016年7月 OpenFeign 首个版本9.0.0,一直持续发布至现在:12.4.x版本(发布很频繁)

1.3 Spring Cloud Feign

  Spring Cloud Feign 是 Spring 对 Feign 的封装,方便集成到 Spring 项目中,添加了对 Spring MVC 注释的支持,并简化了与负载均衡、服务注册发现、断路器等组件的集成
  受 Feign 更名影响,Spring Cloud Feign 也有两个 starter

  • spring-cloud-starter-feign

  • spring-cloud-starter-openfeign

总结:

  • spring-cloud-starter-feign 是 Spring Cloud Feign 的早期版本,现已不在维护
  • spring-cloud-starter-openfeign 是目前正在使用中的 Spring Cloud Feign

二、OpenFeign核心流程

三、源码分析

 

参考:

Feign、OpenFeign、Spring Cloud Feign 的区别 - 掘金 (juejin.cn)