I want to upload multiple files in the rest api using spring. I am able to upload single file using below code
@Path("/line-item/cancel")
@Produces({"application/xml", "application/json"})
@Consumes({MediaType.MULTIPART_FORM_DATA})
@ApiOperation(value = "Api to cancel PO Line Items", response = POLineItemCancellationResponse.class)
POLineItemCancellationResponse cancelPoLineItems(@Multipart(value = "data") String poLineItemCancellationRequestEntry, @Multipart(value="file") InputStream inputStream);
But if I try to input @Multipart(value="file") InputStream[] inputStream
then I am getting null object in input stream.
I have tried using MultiPartFile also
POLineItemCancellationResponse cancelPoLineItem(@RequestPart(value="file") MultipartFile[] files);
But I am getting the below error:
No message body reader has been found for class [Lorg.springframework.web.multipart.MultipartFile;