Hi there,

I'm trying to migrate springboot from 2.7.5 to 3.0.0, and I got a compilation error when I try to run mvn compile.

I think this should be a bug caused by the mismatch between the new version embeded tomcat and the legacy commons-fileupload.

POM

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
    </parent>
...
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

FileUploadController.java

import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.web.bind.annotation.*;


import static org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent;

@RestController
public class FileFacade {

...
    @SneakyThrows
    @PostMapping("/files/{bucket}")
    public void upload(
        RequestContext request,
        @PathVariable String bucket,
        @RequestParam String path
    ) {
        when(isMultipartContent(request))
            .then(
                this::startUploading,
                new UploadingArgs(bucket, path, new ServletFileUpload().getItemIterator(request)));
    }
...
}

Comment From: bclozel

This is expected as support has been removed in favor of standard multipart support. The new baseline is Jakarta EE9+ APIs.

See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes#miscellaneous and https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#web-applications and https://github.com/spring-projects/spring-framework/issues/29562.

Thanks!

Comment From: pcgeng

@bclozel We have the same issue after upgrading spring boot to 3.x since commons-fileupload:1.5 is till using javax.servlet.http.HttpServletRequest for request parsing, which means we cannot use commons-fileupload for large file upload features in spring boot 3.x, right? If so, is there a replacement for large file upload support in spring boot 3.x?

Comment From: bclozel

@pcgeng please use StackOverflow for questions. Feel free to link to the question here.

Comment From: pcgeng

@bclozel I found a similar issue in StackOverflow: https://stackoverflow.com/questions/76517385/commons-fileupload-and-jakarta-servlet, but asked another question: https://stackoverflow.com/questions/76604140/cannot-use-javax-servlet-http-httpservletrequest-in-commons-fileupload1-5-after

Comment From: rakesh-sahani

I found the one more bug while working Jakarta servlet or web. When you will try to access the HttpServletRequest has the newPushBuilder method always gives null object. If you will satisfied the condition but object remains the null