InterviewSolution
| 1. |
What do you understand by MultipartResolver? |
|
Answer» The MultipartResolver is used for handling the file upload scenarios in the Spring web application. There are 2 CONCRETE implementations of this in Spring, they are:
To implement this, we need to create a bean with id=“multipartResolver” in the application context of DispatcherServlet. Doing this ensures that all the requests handled by the DispatcherServlet have this resolver applied whenever a multipart request is detected. If a multipart request is detected by the DispatcherServlet, it resolves the request by means of the already configured MultipartResolver, and the request is passed on as a wrapped/abstract HttpServletRequest. Controllers then cast this request as the MultipartHttpServletRequest interface to get access to the Multipart files. The following DIAGRAM illustrates the FLOW clearly: |
|