Feign is a java to http client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign's first goal was reducing the complexity of binding Denominator uniformly to http apis regardless of restfulness.
Questions tagged [feign]
635 questions
8
votes
2 answers
Openfeign ErrorDecoder caused java.io.IOException: stream is closed
When i try to implements ErrorDecoder to decode the feign exception, i found the stream in response.body() is closed, so when i try to read the stream and trans to string, it throw java.io.IOException: stream is closed. It's really confused because…

bjwzds
- 103
- 1
- 1
- 5
8
votes
5 answers
FeignClient not resolving Eureka service name
I'm writing a Eureka Client Application using spring-cloud-starter-openfeign client.
Here is my POM

Abdul Mohsin
- 1,253
- 1
- 13
- 24
8
votes
2 answers
Feign REST Client: How to get the HTTP status?
I have Feign client setup with Hystrix and I am trying to log all the HTTP status codes that I get from my API calls into a database. So this means, if one of my calls give me a 201, I would want to log that into DB. If my call results in a failure,…

oneCoderToRuleThemAll
- 834
- 2
- 12
- 33
8
votes
3 answers
Is it possible to use Spring @Cache* on Feign client?
I have a Feign client that requests a token from a microservice.
Since I am making multiple calls, I would like to cache the responses received from the Feign client and use Spring Guava caching, but it doesn't seem to work. All I have is the…

Bianca
- 779
- 3
- 9
- 19
8
votes
2 answers
Generic response support for feign client
I am writing a REST client using Feign. There is an endpoint which can be generalized by parameterizing the path. But based on the path I can get a different type of response.
So I am trying to use a single method using generic. Since I must tell…

Kannan Ramamoorthy
- 3,980
- 9
- 45
- 63
8
votes
5 answers
spring boot feign client getting HTTP 404
I am currently just checking how to use Feign as Declarative REST client in one of my project.
following is Feign Client
@FeignClient(name = "SEARCHCABMS",configuration = AppFeignConfiguration.class)
public interface SearchCabMsClient {
…

Ganesh Pol
- 413
- 1
- 8
- 29
7
votes
1 answer
How to get InputStream via Spring-Feign?
I want to download and save a file in local directory from server by Spring-OpenFeign with zero-copy.
Naive download method as following:
import org.apache.commons.io.FileUtils
@GetMapping("/api/v1/files")
ResponseEntity…

dgregory
- 1,397
- 1
- 12
- 26
7
votes
3 answers
File upload spring cloud feign client
When make a post request from one microservice to another using feign client of spring cloud netflix, I get the following error in Postman :
{
"timestamp": 1506933777413,
"status": 500,
"error": "Internal Server Error",
"exception":…

ZiOS
- 433
- 2
- 5
- 14
7
votes
2 answers
Feign - URL encode path params
This is my contract,
@RequestLine("GET /products/{id}")
@Headers({"Content-Type: application/json"})
ApiResponse getProduct(@Param("id") String productId) throws Exception;
I want to fetch the product with id = "a/b",
If I send this as a param to…

NitishDeshpande
- 435
- 2
- 6
- 19
7
votes
1 answer
How to use WireMock on a Feign client in a Spring Boot application?
I have a class that makes use of a Feign client. Previously I used Mockito and gave a stored response for each of the method calls in the Feign client. Now I want to use WireMock, so that I can see that my code handles different kinds of response…

L42
- 3,052
- 4
- 28
- 49
6
votes
1 answer
Use Micrometer with OpenFeign in spring-boot application
The OpenApi documentation says that it supports micrometer. How does the integration works? I could not find anything except this little documentation.
I have a FeignClient in a spring boot application
@FeignClient(name = "SomeService", url = "xxx",…

Marius
- 365
- 4
- 18
6
votes
0 answers
How to create MultipartFile object from InputStream in Spring Boot
I have 2 services ServiceA and ServiceB, ServiceB has one API called createDocument(@RequestParam("file") MultipartFile file). Now I want to call this API from ServiceA and I am using FeignClient and both services use Spring Boot.
My FeignClient…

Pavan
- 217
- 1
- 4
- 12
6
votes
2 answers
How to pass Pageable to Feign Client in POST Request with additional @RequestBody
I tried to create a feign client for my REST service controller in Spring.
@PostMapping("/search")
public Page searchMeasures(@RequestBody MeasureDto example, Pageable pageable) {
...
}
The client looks like…

Manuel Waltschek
- 515
- 1
- 6
- 23
6
votes
1 answer
Feign Error Decoder with custom JSON response
I have an API which will return a failure in form of custom response message, while still sending a Http 200 response. Example:
Status: 200
Body: {
"code":404,
"message":"Data not found",
"data":{},
"status":"ERROR"
}
My current…

Stephan Stahlmann
- 441
- 2
- 5
- 19
6
votes
2 answers
Feign get request with body
For some reason I need to call a GET method API and pass json request body for it. I really couldn't find an example for it. I wonder if it is even supported using feign.
How can I do that using feign?

Ali Farhoudi
- 5,350
- 7
- 26
- 44