Spring CommonsMultipartResolver always return null for the MultipartFile
<p>If I use <code>StandardServletMultipartResolver</code>, I get the file properly, but if I use <code>CommonsMultipartResolver</code> I get null for the file. Even without any additional configuration, just replacing <code>new StandardServletMultipartResolver();</code> with <code>new CommonsMultipartResolver();</code> the files are not received. I wanted to enforce <code>maxUploadSizePerFile</code> and hence used <code>CommonsMultipartResolver</code>.</p>

<p>In my WebContext Configuration file, I have the following:</p>

<pre><code>@Override
@Bean
public MultipartResolver multipartResolver() {
    CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
    Long maxFileSize = environment.getRequiredProperty(PropertyConstants.MAX_FILE_UPLOAD_SIZE, Long.class);
    multipartResolver.setMaxUploadSizePerFile(maxFileSize);
    return multipartResolver;
}
</code></pre>

<p>If I just replace the <code>CommonsMultipartResolver</code> with <code>StandardServletMultipartResolver</code>, things start to work. I have <code>commons-fileupload</code> in mvn dependency and the application gets launched without any error.</p>

<p>I am using Tomcat 9.0.0.M1 and Spring 4.2.2.</p>

<p>Is there some configuration I am missing for <code>CommonsMultipartResolver</code> to work?</p>