Will Spring hold contents in memory or stores in the disk?

前端 未结 4 1114
情话喂你
情话喂你 2021-02-07 20:43

When a file say 100 MB size is uploaded from browser will Spring hold whole data in memory or stores in the disk temporarily. After going through Spring doc I know how to set a

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 21:05

    Yes, but if it's stored on disk it will be deleted after the request has been processed. You can set the threshold for when it will be stored on disk:

    In your multipartresolver bean definition, e.g.:

     
     
    

    If it's held in memory, you could store it in the session and process it in the next request, for instance, such as if you're waiting for a user confirmation.

提交回复
热议问题