gpt4 book ai didi

java - 打开Feign java.lang.NoSuchFieldError : MULTIPART_RELATED Error

转载 作者:行者123 更新时间:2023-12-05 08:04:37 38 4
gpt4 key购买 nike

我想像这样使用 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]*

有人可以帮助我吗? :)

最佳答案

OpenFeign 依赖类 org.springframework.cloud.openfeign.support.SpringEncoder 包含来自 org.springframework.http.MediaType 的常量 MULTIPART_RELATEDorg.springframework.cloud:spring-cloud-starter-openfeign:2.2.8.RELEASE 和以上版本在 SpringEncoder 类中包含此 MULTIPART_RELATED。我正在使用 2.2.7.RELEASE

关于java - 打开Feign java.lang.NoSuchFieldError : MULTIPART_RELATED Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67927242/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com