springboot 上传文件-feign內部調用
1.springboot版本-springboot2.1.6
2.feign间调用
注意的点:
1.注解用:@RequestPart
2.变量:MediaType.MULTIPART_FORM_DATA_VALUE
3.如果不行添加:,required = false
例子:
/**
* 项目共享文件-保存,feign內部調用
*/
@RequestMapping( value = "/feignUploadFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void feignUploadFile(@RequestPart(value = "file",required = false) MultipartFile file, Vo vo) {
return null);
}
调用方:
@FeignClient(name = "xxx")
public interface xxxClient {
@RequestMapping(value = "/xxx/file/feignUploadFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
void feignUploadFile( @RequestPart(value = "file",required = false) MultipartFile file);
}