title: Unable to process parts as no multi-part configuration has been provided
body: <p>I wrote a simple controller for uploading files:</p>
  
  <pre><code>@RestEndpoint
  public class ImageController {
      @Autowired
      GridFsTemplate mTemplate;
  
      @RequestMapping(value = "images", method = RequestMethod.POST)
      public @ResponseBody String testPhoto(@RequestParam String name, @RequestParam String directory, @RequestParam MultipartFile file) throws IOException {
  
          if(!file.isEmpty()){
              final byte[] bytes = file.getBytes();
              InputStream inputStream = new ByteArrayInputStream(bytes);
              mTemplate.store(inputStream, "name");
  
              return "uploaded photo";
          }
  
          return "failed";
      }
  
  } 
  </code></pre>
  
  <p><code>@RestEndpoint</code> annotation is: </p>
  
  <pre><code>@Target({ ElementType.TYPE })
  @Retention(RetentionPolicy.RUNTIME)
  @Documented
  @Controller
  public @interface RestEndpoint
  {
      String value() default "";
  }
  </code></pre>
  
  <p>My ContextCOnfiguration class is:</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(
      basePackages = "com.questter.site",
      useDefaultFilters = false,
      includeFilters =
      @ComponentScan.Filter({RestEndpoint.class, RestEndpointAdvice.class})
  )
  public class RestServletContextConfiguration extends WebMvcConfigurerAdapter {
      @Bean
      public CommonsMultipartResolver multiPartResolver(){
  
          CommonsMultipartResolver resolver = new CommonsMultipartResolver();
          return resolver;
      }
  ...
  }
  </code></pre>
  
  <p>--- UPDATED ---</p>
  
  <p><code>web.xml</code> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                           http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
       version="3.1"&gt;
  
      &lt;display-name&gt;Spring Application&lt;/display-name&gt;
  
      &lt;jsp-config&gt;
          &lt;jsp-property-group&gt;
              &lt;url-pattern&gt;*.jsp&lt;/url-pattern&gt;
              &lt;url-pattern&gt;*.jspf&lt;/url-pattern&gt;
              &lt;page-encoding&gt;UTF-8&lt;/page-encoding&gt;
              &lt;scripting-invalid&gt;true&lt;/scripting-invalid&gt;
              &lt;include-prelude&gt;/WEB-INF/jsp/base.jspf&lt;/include-prelude&gt;
              &lt;trim-directive-whitespaces&gt;true&lt;/trim-directive-whitespaces&gt;
              &lt;default-content-type&gt;text/html&lt;/default-content-type&gt;
          &lt;/jsp-property-group&gt;
      &lt;/jsp-config&gt;
  
      &lt;!--&lt;context-param&gt;--&gt;
          &lt;!--&lt;param-name&gt;spring.profiles.active&lt;/param-name&gt;--&gt;
          &lt;!--&lt;param-value&gt;development&lt;/param-value&gt;--&gt;
      &lt;!--&lt;/context-param&gt;--&gt;
  
      &lt;session-config&gt;
          &lt;session-timeout&gt;30&lt;/session-timeout&gt;
          &lt;cookie-config&gt;
              &lt;http-only&gt;true&lt;/http-only&gt;
          &lt;/cookie-config&gt;
          &lt;tracking-mode&gt;COOKIE&lt;/tracking-mode&gt;
      &lt;/session-config&gt;
  
      &lt;distributable /&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>---- UPDATED ----</p>
  
  <pre><code>public class Bootstrap implements WebApplicationInitializer
  {
  
      @Override
      public void onStartup(ServletContext container) throws ServletException
      {
          container.getServletRegistration("default").addMapping("/resource/*");
  
          AnnotationConfigWebApplicationContext rootContext =
              new AnnotationConfigWebApplicationContext();
          rootContext.register(RootContextConfiguration.class);
          container.addListener(new ContextLoaderListener(rootContext));
  
          AnnotationConfigWebApplicationContext webContext =
              new AnnotationConfigWebApplicationContext();
          webContext.register(WebServletContextConfiguration.class);
          ServletRegistration.Dynamic dispatcher = container.addServlet(
              "springWebDispatcher", new DispatcherServlet(webContext)
          );
          dispatcher.setLoadOnStartup(1);
          dispatcher.setMultipartConfig(new MultipartConfigElement(
              null, 20_971_520L, 41_943_040L, 512_000
          ));
          dispatcher.addMapping("/");
  
          AnnotationConfigWebApplicationContext restContext =
                  new AnnotationConfigWebApplicationContext();
          restContext.register(RestServletContextConfiguration.class);
          DispatcherServlet servlet = new DispatcherServlet(restContext);
          servlet.setDispatchOptionsRequest(true);
          dispatcher = container.addServlet(
                  "springRestDispatcher", servlet
          );
          dispatcher.setLoadOnStartup(2);
          dispatcher.addMapping("/rest/*");
  
          rootContext.refresh();
          DbBootstrap dbBootstrap = rootContext.getBean(DbBootstrap.class);
          dbBootstrap.init();
  
      }
  
  
  }
  </code></pre>
  
  <p>When perfoming a post request (using postman) i'm getting:</p>
  
  <pre><code>HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException:Expected MultipartHttpServletRequest: is a MultipartResolver configured 
  </code></pre>
  
  <p>I've looked over some similar questions over stackoverflow but none of the answers helped
  me.</p>
  
  <p>Spring version is: 4.0.4</p>
  
  <p>Any help will be greatly appreciated (with a thumbs up of course).</p>
  
  <p>Thanks</p>