I'm having a problem uploading an image using feign. I have multiple services using spring cloud. Version of my dependencies below
spring boot - 1.4.3.RELEASE
spring-cloud-starter-feign - 1.1.3.RELEASE
io.github.openfeign.form - 2.2.1
io.github.openfeign.form - 2.2.1
In my form I have fields with a Multipartfile ex below
public class MyFrom {
private String field1;
private String field2;
private MultipartFile image;
//getters and setters
}
And passing it in my feign client
@RequestMapping(value = { "/api/some-task},
method = RequestMethod.POST,
consumes = {"multipart/form-data"})
ResponseEntity<MyForm> addPromoTask(@RequestBody MyForm request);
I already added a SpringFormEncoder in my code but I've check the encoder's code but it doesn't seem to support when Multipartfile is included in the RequestBody.
@FeignClient(value = "some-feign",
fallback = SomeTaskClient.SomeTaskClienttFallback.class,
configuration = SomeTaskClient.CoreFeignConfiguration.class)
public interface SomeTaskClient extends SomeTaskApi {
@Configuration
class CoreFeignConfiguration {
@Bean
@Primary
@Scope(SCOPE_PROTOTYPE)
Encoder feignFormEncoder() {
return new SpringFormEncoder();
}
}
}
I have seen that you can pass multiple @RequestPart in the link below but I can't seem to make it work. I get an error where it says I'm passing multiple body parameters.