Open Feign java.lang.NoSuchFieldError: MULTIPART_RELATED Error

Viewed 948

I want to upload a file with Feign like this :

    @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);
    }

But I have this error when I call 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]*

Someone can help me please ? :)

1 Answers

Upgrade spring version at least 5.2.5

Related