title: How to pass Multipart file from one service to another service in spring boot?
body: <p>I would like to pass multipart file from one service to another.</p>
  
  <p>Client --> Service1 --> Service2 </p>
  
  <p>This shows an error "500 internal server error, Current request is not a multipart request" <strong>when I pass the file from Service1 to Service2</strong></p>
  
  <p>Client --> Service2 when I send the file directly its working but not through Service1</p>
  
  <p>I want to know what could be the reason, I guess I am missing some header parts when passing the multipart file as parameter.</p>
  
  <p><strong><em>Service2</em></strong></p>
  
  <pre><code>@PostMapping(path="/upload")
  public ResponseEntity&lt;Properties&gt; upload(@RequestParam("file") MultipartFile multiPart) {
      return saveFile(multiPart);
  }
  </code></pre>
  
  <p><strong><em>Service2-client</em></strong></p>
  
  <pre><code>@FeignClient
  (name="${feign.upload.serverId}", configuration = UploadServiceClientConfiguration.class, decode404 = true)
  public interface UploadServiceClient {
  
      @PostMapping(path="/upload")
      ResponseEntity&lt;Properties&gt; upload(@RequestParam("file") MultipartFile multiPart);
  
      class UploadServiceClientConfiguration {
          @Value(value="${feign.upload.user}")
          String user;
          @Value(value="${feign.upload.password}")
          String password;
          @Bean
          public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
              return new BasicAuthRequestInterceptor(user, password);
          }
      }
  }
  </code></pre>
  
  <p><strong><em>Service1</em></strong></p>
  
  <pre><code>@Autowired
  UploadServiceClient uploadSvcClient;
  @PostMapping(path="/upload")
  public ResponseEntity&lt;Properties&gt; uploadAttachment(@RequestParam("file") MultipartFile file) {
      return uploadSvcClient.upload(file);
  }
  </code></pre>