Spring boot version: 2.4.1

Test:

@Test
@WithMockUser(roles = "APP_OWNER")
void given_application_owner_then_applicationUpload_should_throw_403() throws Exception {
    MockMultipartFile file = new MockMultipartFile("file", "some content".getBytes());
    mockMvc.perform(
            multipart("/applications/actions/upload").file(file).header("Content-Type", "multipart/form-data"))
            .andExpect(status().isForbidden());
}

Controller:

@PostMapping(value = "/actions/upload",
        consumes = { MediaType.MULTIPART_FORM_DATA_VALUE, "multipart/form-data;charset=UTF-8" })
@RolesAllowed("ADMIN")
public List<ApplicationUploadStatusDTO> uploadApplications(@RequestParam("file") MultipartFile file) {
    // Do something here
}

Expected result: 403 error Actual result: 400

MockHttpServletResponse:
           Status = 400
    Error message = Required request part 'file' is not present
          Headers = [X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY"]
     Content type = null
             Body = 
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

Same code is working as expected with spring-boot 2.4.0

Comment From: wilkinsona

@sudhirtumati Thanks for the report. To help us to identify the cause of the change in behaviour, could you please provide a complete yet minimal sample that reproduces the problem? You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: sudhirtumati

@wilkinsona Sample application is available at https://github.com/sudhirtumati/spring_boot_issue_24483_sample

main branch - uses spring boot 2.4.0 and test pass successfully feature/upgrade-spring-boot-version branch uses spring boot 2.4.1 and test fails

Comment From: wilkinsona

Thanks for the sample. I've reproduced the problem and it appears to be caused by the changes made for https://github.com/spring-projects/spring-framework/issues/26166. We'll transfer this issue to the Framework team so that they can take a look.

Comment From: bclozel

I’m closing this as a duplicate of #26261

Comment From: rstoyanchev

Yes it is a duplicate of #26261 indeed.