Multipart Configuration for JBoss Enterprise Application Platform/Application Server

Spring REST controller on Spring Boot (1.12) was not accepting multi-part requests for file upload on JBoss EAP/AS but working on Embedded Tomcat.

org.springframework.web.bind.MissingServletRequestParameterException: Required MultipartFile parameter 'file' is not present

I needed to add a multipart filter on my web xml configuration in Java

@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableJpaRepositories
@EnableSpringDataWebSupport
public class Application extends SpringBootServletInitializer {

 @Override
 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
 return application.sources(Application.class);
 }

 @Override
 public void onStartup(ServletContext servletContext) throws ServletException {
 WebApplicationContext context = createRootApplicationContext(servletContext);
 ServletRegistration.Dynamic servletRegistration = servletContext.addServlet("dispatcher", new DispatcherServlet(context));
 servletRegistration.setLoadOnStartup(1);
 servletRegistration.addMapping("/*"); // required JBOSS EAP
 servletRegistration.setMultipartConfig(getMultiPartConfig()); // fixes multipart requests
 super.onStartup(servletContext);
 }

 private MultipartConfigElement getMultiPartConfig() {
 String location = "";
 long maxFileSize = -1;
 long maxRequestSize = -1;
 int fileSizeThreshold = 0;
 return new MultipartConfigElement(
 location,
 maxFileSize,
 maxRequestSize,
 fileSizeThreshold
 );
 }

 public static void main(String[] args) {
 SpringApplication.run(Application.class, args);
 }
}

My Spring and web.xml is configured via Java annotations.

I found this post for this configuration: http://stackoverflow.com/questions/19293862/how-make-the-setmultipartconfig-work-for-a-dynamic-added-servlet