当前位置:   article > 正文

feign上传文件报错(已解决) No serializer found for class java.io.FileDescriptor and no

no serializer found for class java.io.filedescriptor and no properties disco

今天用feign上传文件报错,详细报错信息如下

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile["inputStream"]->java.io.FileInputStream["fd"])

解决方案:feign客户端接口上加上

,consumes = MediaType.MULTIPART_FORM_DATA_VALUE

如:

@RequestMapping(value = "/minioFile/uploadFile", method = RequestMethod.POST, produces = "application/json;charset=UTF-8",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ApiOperation(value = "文件上传", notes = "文件上传,form-data,key=multipartFile;")
DataResponse<UploadFileVO> fileUpload(MultipartFile multipartFile);

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/70019
推荐阅读
相关标签
  

闽ICP备14008679号