1. What is the purpose of the MultipartResolver interface in Spring MVC?
Why:MultipartResolver is a strategy interface that Spring uses to process multipart requests, such as file uploads.
2. Is a MultipartResolver registered by default in Spring MVC?
Why: No default MultipartResolver bean is registered. To enable file uploads, the application has to register an implementation.
3. Which bean name does DispatcherServlet use to find the MultipartResolver?
Why:DispatcherServlet looks for a bean named multipartResolver. If the bean has a different name, it will not be found.
4. What does the isMultipart() method of MultipartResolver do?
Why:isMultipart() checks whether the given request contains multipart content. DispatcherServlet calls it to find out if the request is a file upload.
5. What does the resolveMultipart() method do?
Why:resolveMultipart() parses the request into files and parameters. It then wraps the request in a MultipartHttpServletRequest, which gives access to the uploaded files.
6. What is the job of the cleanupMultipart() method?
Why:cleanupMultipart() lets the implementation release resources used for multipart handling, such as storage for the uploaded files.
7. When does DispatcherServlet call cleanupMultipart()?
Why:DispatcherServlet calls cleanupMultipart() at the end of request processing, so that used resources can be released.
8. Which content type does a typical file upload request use?
Why: A file upload request is typically a POST request with the content type multipart/form-data.
9. Which implementation of MultipartResolver relied on the third-party Apache Commons FileUpload library?
Why:CommonsMultipartResolver was based on Apache Commons FileUpload. It parsed multipart requests inside the application and did not depend on the servlet container.
10. How does StandardServletMultipartResolver parse multipart requests?
Why:StandardServletMultipartResolver uses the native multipart parsing of Servlet 3.0+ containers, so no extra library is needed.
11. Why did the Spring team recommend moving away from CommonsMultipartResolver?
Why: Modern servlet containers already provide good multipart handling. Removing the third-party library also reduced maintenance work and classloading problems.
12. What happened to CommonsMultipartResolver in Spring 6?
Why:CommonsMultipartResolver was deprecated in Spring 5.0 and fully removed in Spring 6. StandardServletMultipartResolver is the implementation to use.
13. Which type represents an uploaded file received in a multipart request in Spring?
Why:MultipartFile is a Spring interface that represents an uploaded file received in a multipart request. It can be used as a controller method parameter.
14. What does MultipartHttpServletRequest give a controller access to?
Why:MultipartHttpServletRequest wraps the original request and gives access to the uploaded file information and content. Its parameters are available through the standard ServletRequest methods.