Springcloud feign文件上传报错FileUploadException: the request was rejected because no multipart boundary

    spring cloud,写了一个图片上传的服务,直接用postman 请求这个服务,是没有问题的,
    但是在web层(comsumer层?)用feign去调用这个服务,就报错了,
    the request was rejected because no multipart boundary was found,最后查了半天原来是spring版本和feign-form的版本不对应的原因导致的,升级了feign-form的版本,问题解决

    1. <dependencies>
    2. <dependency>
    3. <groupId>io.github.openfeign.form</groupId>
    4. <artifactId>feign-form</artifactId>
    5. <version>x.y.z</version>
    6. </dependency>
    7. <dependency>
    8. <groupId>io.github.openfeign.form</groupId>
    9. <artifactId>feign-form-spring</artifactId>
    10. <version>x.y.z</version>
    11. </dependency>
    12. </dependencies>
    1. @FeignClient(name = "feign-service",configuration =MultipartSupportConfig.class)
    2. public interface FeignService{
    3. @RequestMapping(value = "/uploads", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    4. String uploads(@RequestPart("file") MultipartFile file);
    5. }
    1. public class MultipartSupportConfig {
    2. @Autowired
    3. private ObjectFactory<HttpMessageConverters> messageConverters;
    4. @Bean
    5. public Encoder feignFormEncoder() {
    6. return new SpringFormEncoder(new SpringEncoder(messageConverters));
    7. }
    8. }