I faced a situation where I need to upload files with size up to 1GB to my WebService. I use Spring and before I used MultipartFile for uploading files. But if we have endpoint like this:
//Spring annotations
public void upload(MultipartFile file) {
System.out.print("Hello world!");
}
by the time thread reaches line with System.out.print("Hello world!")
, all file is within the memory (JVM I mean) which may be a good option for small files, but not an option for files with 1GB size (if two users are trying to upload two files with 1GB size then we use 2GB RAM).
Perhaps there is another way to handle such a situation with Spring?
Thanks, cheers, Andrey