首页 > 解决方案 > 带有 MultiValueMap 的 Spring Cloud Feign 版本 2020.04 问题

问题描述

下面是我要调用的端点。

@PostMapping(value = "test",
      consumes = MULTIPART_FORM_DATA_VALUE)
  Response addVariable(MultiValueMap<String, Object> body);

它在 SpringFeign Hoxton.SR1的早期版本中运行良好。使用当前版本,我从服务提供商处收到 500 错误。服务提供商没有任何变化,并且在以前的版本中仍然可以正常工作。

> <html> <head> <meta http-equiv="Content-Type"
> content="text/html;charset=utf-8"/> <title>Error 500 Request
> failed.</title> </head> <body><h2>HTTP ERROR 500 Request failed.</h2>
> <table> <tr><th>URI:</th><td>/test</td></tr>
> <tr><th>STATUS:</th><td>500</td></tr> <tr><th>MESSAGE:</th><td>Request
> failed.</td></tr>
> <tr><th>SERVLET:</th><td>org.camunda.bpm.spring.boot.starter.rest.CamundaJerseyResourceConfig</td></tr>
> </table> </body> </html> workflow-services
> a1d051de-f70e-4248-900c-2c5c2d6d5cc0 W586159 - 2021.11.13 15:52:06.835
> [http-nio-7071-exec-2] <--- END HTTP (522-byte body)
> ------------------------------------------------------------------------

无代码更改..仅从 2.2.4.RELEASE 升级版本-- > 2.5.6

由于在新版本的弹簧编码器中添加了额外的更改,代码正在中断。

if (Objects.equals(requestContentType, MediaType.MULTIPART_FORM_DATA)) {
                this.springFormEncoder.encode(requestBody, bodyType, request);
                return;
            }

标签: javaspring-bootspring-cloudspring-cloud-feign

解决方案


推荐阅读