In #30342 we added support for MultipartFile in a separate arguments resolver. The resolver is documented as not requiring @RequestPart since it's recoginized by type and can be made optional with java.util.Optional. However, it also shouldn't fail if that combination is used, and right now that's not the case as mentioned in as per https://github.com/spring-projects/spring-framework/issues/30342#issuecomment-1691949955, since the resolver for @RequestPart is used first.

I think we should reconsider a tighter integration between the two resolvers, and maybe even merge them into the RequestPartArgumentResolver so it supports @RequestPart with MultipartFile but also just MultipartFile.

/cc @OlgaMaciaszek

Comment From: rstoyanchev

Superseded by #31164.