I want to upload a file by calling a rest web-service. This web-service need a MultipartFile.
I read here that I can do this : Multipart File Upload Using Spring Rest Template + Spring Web MVC
So, here is my code :
public Document uploadDocument(MultipartFile file) {
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(backendURL + "documents/upload");
        URI uri = builder.build().encode().toUri();
        LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
        map.add("file", file);
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        HttpEntity<LinkedMultiValueMap<String, Object>> requestEntity =
                new HttpEntity<LinkedMultiValueMap<String, Object>>(map, headers);
        try {
            ResponseEntity<Document> responseEntity = restTemplate.exchange(uri, HttpMethod.POST, requestEntity, Document.class);
        } catch (Exception e) {
            e.getMessage(); // Crash here
        }
        return document.getBody();
    }
Jackson try to serialize the file in JSON, but it fail with this error :
Could not write content: No serializer found for class java.io.FileDescriptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.springframework.web.multipart.support.StandardMultipartFile["inputStream"]->java.io.FileInputStream["fd"])
What can I do to disable the json serialization of the file ?