I am using spring boot for uploading files. The files sizes are usually about 2GB and we cannot use the default spring boot StandardServletMultipartResolver
or
If you enable resolve-lazily
, the result is exactly what I think you're asking for.
spring.servlet.multipart.enabled = true
spring.servlet.multipart.resolve-lazily = true
Now you can write controllers with either form of signature.
Pre-parsing by the built-in multipart resolver...
@PostMapping("/upload1")
public ResponseEntity postUpload1(
@RequestParam("metadata") MultipartFile metadata,
@RequestParam("payload") MultipartFile payload)
Or post-parsing (which you can parse yourself)...
@PostMapping(path = "/upload2", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity postUpload2(HttpServletRequest rawRequest)