概述
如何使用openfeign
调用文件上传的远程服务呢? 其feignClient
如何编写呢?
- 使用
@RequestPart
示例说明
FeignClient
接口中文件类型的入参要用@RequestPart
注解, 且要设置请求头信息ContentType
为multipart/form-data
.
编写feignClient
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE )
void upload(@RequestPart(value = "file") MultipartFile file);