Multipart support
By default AcrossWebModule will attempt to automatically configure a MultipartFilter to support multipart form data.
When correctly configured, this will enable multipart support for all servlets and web requests.
By default a StandardServletMultipartFilter is being added, that builds on top of the Servlet 3.0 specification.
Servlets will still need a MultipartConfigElement set for multipart data to be handled correctly.
The latter is done automatically for the DispatcherServlet.
Multipart settings can be configured using the spring.http.multipart.* properties from Spring Boot (MultipartProperties class).
Alternatively you can provide a custom MultipartConfigElement bean.
This bean will be automatically picked up for the configuration.
If none is present, AcrossWebModule will create a default bean.
Disabling the automatic multipart resolving configuration can be done by setting property spring.http.multipart.enabled to false.
If Apache Commons Fileupload is available on the classpath, the filter will be configured using a CommonsMultipartResolver instead.
It is also possible to manually create a MultipartResolver bean.
The bean name will determine how multipart resolving is applied:
- filterMultipartResolver
-
Will still enable the
MultipartFilterto be registered but will use the configured bean as its internal resolver. - multipartResolver
-
Will disable the
MultipartFilterregistration, but will register the resolver on theDispatcherServlet. Multipart support will only be enabled on requests made through theDispatcherServlet.
Spring Boot will automatically rename any MultipartResolver bean to multipartResolver so it will be picked up by the DispatcherServlet.
If you want to use the MultipartFilter but want to customize the MultipartResolver it uses, you should ensure that the resolver bean is injected in the AcrossWebModule and not exposed.
|