Home > Back-end >  Feign transfer files
Feign transfer files

Time:11-10


Interface:

OssInnerUploadResponse upload4Back (@ RequestPart (value="https://bbs.csdn.net/topics/file") @ NotNull MultipartFile file, @ RequestParam (value="https://bbs.csdn.net/topics/appCode") AppCodeEnum appCode);

Controller:

OssInnerUploadResponse upload4Back (@ RequestPart (value="https://bbs.csdn.net/topics/file") MultipartFile file, @ RequestParam (value="https://bbs.csdn.net/topics/appCode") AppCodeEnum appCode) {}

Invoke: DefaultMultipartFile file=new DefaultMultipartFile (fileName, outputStream toByteArray ()); OssInnerUploadResponse result=commonOssFeignClient. Upload4Back (file, appCode);

Configuration:

@ Bean
@ Primary
@ the Scope (" prototype ")
Public Encoder feignFormEncoder () {
Return new SpringFormEncoder (new SpringEncoder (messageConverters));
}

But there are still problems Required request parts' file 'is not present

CodePudding user response:

http://www.itmuch.com/spring-cloud-sum/spring-cloud-feign-upload/
Can look at this
  • Related