You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `feign-form` extension depend on `OpenFeign` and its *concrete* versions:
1313
+
1314
+
- all `feign-form` releases before **3.5.0** works with `OpenFeign` **9.\*** versions;
1315
+
- starting from `feign-form`'s version **3.5.0**, the module works with `OpenFeign` **10.1.0** versions and greater.
1316
+
1317
+
>**IMPORTANT:** there is no backward compatibility and no any gurantee that the `feign-form`'s versions after **3.5.0** work with `OpenFeign` before **10.\***. `OpenFeign` was refactored in 10th release, so the best approach - use the freshest `OpenFeign` and `feign-form` versions.
1318
+
1319
+
Notes:
1320
+
1321
+
- [spring-cloud-openfeign](https://github.com/spring-cloud/spring-cloud-openfeign) uses `OpenFeign` **9.\*** till **v2.0.3.RELEASE** and uses **10.\*** after. Anyway, the dependency already has suitable `feign-form` version, see [dependency pom](https://github.com/spring-cloud/spring-cloud-openfeign/blob/master/spring-cloud-openfeign-dependencies/pom.xml#L19), so you don't need to specify it separately;
1322
+
1323
+
- `spring-cloud-starter-feign` is a **deprecated** dependency and it always uses the `OpenFeign`'s **9.\*** versions.
1324
+
1325
+
## Usage
1326
+
1327
+
Add `FormEncoder` to your `Feign.Builder` like so:
1328
+
1329
+
```java
1330
+
SomeApi github = Feign.builder()
1331
+
.encoder(new FormEncoder())
1332
+
.target(SomeApi.class, "http://api.some.org");
1333
+
```
1334
+
1335
+
Moreover, you can decorate the existing encoder, for example JsonEncoder like this:
public interface FileUploadServiceClient extends IFileUploadServiceClient {
1481
+
1482
+
public class MultipartSupportConfig {
1483
+
1484
+
@Bean
1485
+
public Encoder feignFormEncoder () {
1486
+
return new SpringFormEncoder();
1487
+
}
1488
+
}
1489
+
}
1490
+
```
1491
+
1492
+
Thanks to [tf-haotri-pham](https://github.com/tf-haotri-pham) for his feature, which makes use of Apache commons-fileupload library, which handles the parsing of the multipart response. The body data parts are held as byte arrays in memory.
1493
+
1494
+
To use this feature, include SpringManyMultipartFilesReader in the list of message converters for the Decoder and have the Feign client return an array of MultipartFile:
0 commit comments