File upload of CommonsMultipartFile using RestTemplate is failing
问题 I'm trying to consume a web service that accepts a CommonsMultipartFile in the request. So, I created an HTTP client using Spring's RestTemplate. Below is the method that takes in URI and a MultipartFile as parameters. I'm trying to pass this file to the web service in the form of ByteArrayResource. public String upload(String uri, MultipartFile file) throws IOException { logger.info("URI: " + uri); ByteArrayResource fileAsResource = new ByteArrayResource(file.getBytes()) { @Override public