title: Switching to JavaConfig multipartResolver not working
body: <p>We're in the process of switching to JavaConfig and we're having a problem getting multipart uploading to work</p>
  
  <pre><code>org.springframework.web.multipart.MultipartException: The current request is not a multipart request
  </code></pre>
  
  <p>Our configuration still uses security.xml and I tried following some suggestions</p>
  
  <p><a href="https://stackoverflow.com/questions/30809833/multipartresolver-and-abstractannotationconfigdispatcherservletinitializer">MultipartResolver and AbstractAnnotationConfigDispatcherServletInitializer</a></p>
  
  <p><a href="https://stackoverflow.com/questions/23856254/how-to-nicely-handle-file-upload-maxuploadsizeexceededexception-with-spring-secu">How to nicely handle file upload MaxUploadSizeExceededException with Spring Security</a></p>
  
  <p>However, it isn't working. </p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = {"nl.project.controller"},includeFilters={
  @ComponentScan.Filter(type=FilterType.ANNOTATION,value=Controller.class),
  @ComponentScan.Filter(type=FilterType.ANNOTATION,value=RestController.class)
  })
  public class ServletConfig extends WebMvcConfigurerAdapter{
  
  @Bean
  public CommonsMultipartResolver filterMultipartResolver(){
      CommonsMultipartResolver resolver = new CommonsMultipartResolver();
      resolver.setMaxUploadSize(5000000);
      resolver.setMaxInMemorySize(10000);
      resolver.setDefaultEncoding("utf-8");
      return resolver;
  }
  </code></pre>
  
  <p>Any suggestions would be much appreciated!</p>