Spring和Feign Client损坏了图像

时间:2017-08-21 15:31:13

标签: spring-boot spring-cloud netflix-feign spring-cloud-feign feign

对不起我的英语不好:(

我想使用Feign Client上传图片文件,但服务器应用程序上的图片已损坏。

uint16_t

使用客户端应用和服务器应用保存相同的图像。但结果如下:

ldexp()

出了什么问题?请帮帮我。

1 个答案:

答案 0 :(得分:0)

我建议将Feign编码器用于多部分/表单数据表单。 步骤进行:

首先,将此依赖项包含在项目的pom.xml文件中:

<dependency>
    <groupId>io.github.openfeign.form</groupId>
    <artifactId>feign-form</artifactId>
    <version>2.2.1</version>
</dependency>

然后,添加此配置:

@Configuration
public class FeignClientConfiguration {
    @Bean
    @Primary
    @Scope("prototype")
    public Encoder encoder() {
        return new SpringFormEncoder();
    }
 }

并更改注释:

@FeignClient(name = "media-client", url = "${api.base-path}/media", configuration = FeignClientConfiguration.class)