Inject Multipart file as DTO into Spring Controller
Suppose you have a Sprint controller which accepts a multipart Excel file, which you need to parse and process. One way doing this is adding a Multipart argument to your controller method, using a library like apache poi to parse the excel file and extract data from it, and finally to do something with the data. Wouldn’t it be nice if the Excel data were passed into your controller method as a DTO, instead of a multipart file, this way you wouldn’t have to worry about parsing the excel file yourself.