【发布时间】:2023-03-14 07:21:01
【问题描述】:
我想像这样使用 Feign 上传文件:
@FeignClient(name = "GDC", url = "${gdc.url}", configuration = ApiConfig.class)
public interface GDCClient {
@RequestMapping(method = RequestMethod.POST, value = "/v1/document", consumes
="multipart/form-data")
Response saveDocument(@RequestPart(value = "file") MultipartFile fileSaveDocumentDTO,
@RequestPart(value = "document") SaveDocumentDTO saveDocumentDTO);
}
但是当我调用 saveDocument 时出现此错误:
*java.lang.NoSuchFieldError: MULTIPART_RELATED
at org.springframework.cloud.openfeign.support.SpringEncoder.isMultipartType(SpringEncoder.java:227) ~[spring-cloud-openfeign-core-2.2.8.RELEASE.jar:2.2.8.RELEASE]
at org.springframework.cloud.openfeign.support.SpringEncoder.encode(SpringEncoder.java:102) ~[spring-cloud-openfeign-core-2.2.8.RELEASE.jar:2.2.8.RELEASE]
at org.springframework.cloud.openfeign.support.PageableSpringEncoder.encode(PageableSpringEncoder.java:101) ~[spring-cloud-openfeign-core-2.2.8.RELEASE.jar:2.2.8.RELEASE]*
有人可以帮助我吗? :)
【问题讨论】:
标签: java file upload feign openfeign