A Java HTTP client binder that simplifies writing declarative HTTP API clients using annotations.
Feign is a Java HTTP client binder that simplifies writing HTTP API clients by using declarative annotations on Java interfaces. It processes annotations into templatized HTTP requests, reducing boilerplate code and making it easier to integrate with text-based HTTP APIs. It solves the complexity of uniformly binding Java code to various HTTP APIs, whether RESTful or SOAP-based.
Java developers building HTTP API clients for microservices, REST APIs, or SOAP services who want a declarative, annotation-driven approach with minimal overhead.
Developers choose Feign for its simplicity, extensibility, and strong integration ecosystem—it supports various encoders/decoders, HTTP clients, and tools like Hystrix for circuit breaking, all while maintaining a clean contract-based design that is easy to unit test.
Feign makes writing java http clients easier
Annotations like @RequestLine and @Param reduce boilerplate by templating HTTP requests directly from Java interfaces, making client code concise and readable.
Supports multiple encoders/decoders (Gson, Jackson, JAXB), HTTP clients (OkHttp, Ribbon), and tools like Hystrix for circuit breaking, as detailed in the integrations section.
Configurable error decoders and retry logic, including examples for handling 401 errors with token refresh, provide robust fault tolerance out of the box.
Offers async clients via CompletableFuture with AsyncFeign builder, allowing non-blocking HTTP calls for improved performance in concurrent applications.
The roadmap admits that full RFC 6570 level 1-4 expression support is not yet implemented, limiting advanced URI construction for complex APIs.
Planned updates like Retry API refactor and async execution may involve non-backward-compatible changes, risking stability for production code.
Integrations require careful management of multiple modules (e.g., feign-form for multipart support) and version compatibility, especially with Spring Cloud.
Feign is an open-source alternative to the following products:
Asynchronous Http and WebSocket Client library for Java
Ribbon is a Inter Process Communication (remote procedure calls) library with built in software load balancers. The primary usage model involves REST calls with various serialization scheme support.
Unirest in Java: Simplified, lightweight HTTP client library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.