Netflix Feign与OpenFeign的区别是什么?
Netflix Feign vs OpenFeign: Key Differences Explained
Hey there! I see you've been using Netflix Feign paired with Ribbon—totally get why you think it's such a useful combo for declarative service calls. Your sample code looks spot-on for that setup:
@FeignClient(name = "ldap-proxy") public interface LdapProxyClient { @RequestMapping(path = "/ldap-proxy/v1/users/{userNameOrEMail}", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) LdapUser search(@PathVariable("userNameOrEMail") String userNameOrEMail); }
Now, onto your question about the difference between Netflix Feign and OpenFeign—let's break this down clearly so you know which one makes sense for your use case (especially if you want to cut down on manual client definitions):
Core Origin & Maintenance
- Netflix Feign: This was the original implementation built by Netflix for their internal microservices ecosystem. However, Netflix has officially deprecated it (alongside other old OSS tools like Ribbon and Hystrix) and it's no longer actively maintained. No new features or bug fixes are coming down the line here.
- OpenFeign: This is the community-driven fork of Netflix Feign, now maintained under the Spring Cloud umbrella. It's actively updated, receives new features, and is fully aligned with modern Spring ecosystem components.
Feature Set & Flexibility
- Netflix Feign: It's a minimal implementation that covers the basics: declarative REST client definitions, integration with Ribbon for load balancing, and Hystrix for circuit breaking. But since its dependencies are deprecated, these integrations are becoming less viable.
- OpenFeign: It expands heavily on Netflix Feign's core functionality:
- Native support for Spring MVC annotations (like
@GetMapping,@PostMapping) instead of relying solely on generic@RequestMapping - Seamless integration with modern Spring Cloud LoadBalancer (replacing the deprecated Ribbon)
- Out-of-the-box Spring Boot auto-configuration—no manual bean setup required
- Better compatibility with newer Spring Framework and Spring Boot versions
- More extensibility options (custom interceptors, encoders/decoders, error handlers)
- Native support for Spring MVC annotations (like
Ecosystem Fit
- Netflix Feign: If you're using it with Spring, you'll need to manually configure most components (load balancing, circuit breakers, etc.), which adds extra boilerplate.
- OpenFeign: It's deeply integrated with Spring Boot. Just add the
spring-cloud-starter-openfeigndependency, annotate your main class with@EnableFeignClients, and it handles the rest. Plus, you can even generate Feign clients automatically from OpenAPI specs using tools likespring-cloud-openfeign-generator—perfect for avoiding writing all those manual client definitions you mentioned!
Deprecation & Long-Term Viability
- Netflix Feign is on life support—using it in new projects is not recommended, as you'll run into compatibility issues with newer Spring versions and won't get any updates.
- OpenFeign is the current, supported standard for declarative REST clients in Spring Cloud. It's the safe choice for long-term projects.
内容的提问来源于stack exchange,提问作者Μenelaοs
相关产品推荐
相关产品推荐

