Search code examples
javaspring-bootservletsapache-commons-fileupload

commons-fileupload and jakarta.servlet


We are currently in the process of migrating our application to Spring Boot 3. We have been using the Commons FileUpload streaming API to directly load large multipart files into a remote file share. However, we have encountered an issue where the javax.servlet.http.HttpServletRequest has been migrated to jakarta.servlet.http.HttpServletRequest. As a result, the FileUpload library is no longer functioning since it requires javax.servlet.http.HttpServletRequest.

Does Servlet API or Spring framework provide a similar functionality for file streaming without the need to save all files in memory beforehand?


Solution

  • Apache is planning to release a new version of FileUpload that supports Jakarta, which should resolve the issues with migrating from javax to jakarta.

    Please note that the dependency declaration will be changed for the new version. You can refer to the previous link for more information:

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-fileupload2-jakarta</artifactId>
      <version>2.0.0</version>
    </dependency>