I have below rest endpoint in my application with spring boot version as 3.1.4 and Java 17
@PostMapping(value = "/upload", consumes = {"*/*"}, produces = {"*/*"})
public ResponseEntity upload(@RequestPart(value = "file") MultipartFile file) {
log.info("upload :: file : {}.", file);
return null;
}
But when I tried invoking this endpoint from postman and with curl command getting the error as below
{
"timestamp": "2023-10-21T01:47:26.217+00:00",
"path": "/upload",
"status": 400,
"error": "Bad Request",
"requestId": "6db7d61"
}
Any help much appreciated. Thanks.
After spending a lot of time I figured out that spring webflux doesn't support MultipartFile, so to process the multipart data in a streaming fashion I need to use Flux, so the solution is