My api receives a param MultipartFile. I am unable to bind that file with a list of objects?
I work on Spring-boot 2.0.8
with Java 8
I tried this:
public ResponseEntity<Long> addReferenceByFile(HttpServletRequest request,
@PathVariable String numeroLicence,
@RequestParam("references") MultipartFile references) throws URISyntaxException {
and this:
try {
InputStream inputStream = references.getInputStream();
ObjectMapper objectMapper = new ObjectMapper();
ArrayList<Reference> references1 = objectMapper.readValues(references, Reference.class);
} catch (IOException e) {
e.printStackTrace();
}
ObjectMapper doesn't accept InputStream
data. My requirement is to get a list to use for unitary treatment.
Would someone help me find a solution for this issue?