赞
踩
今天用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);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。