I've got a spring boot application which uses Jersey. I've got the following properties in application.properties
:
# Enable multipart.
spring.servlet.multipart.enabled=true
# Write files larger than 1MB to disk (instead of memory).
spring.servlet.multipart.file-size-threshold=1MB
# Set location for multipart file uploads.
spring.servlet.multipart.location=/tmp/tomcat
# Max file size.
spring.servlet.multipart.maxFileSize=100MB
# Max request size.
spring.servlet.multipart.maxRequestSize=100MB
# Set max header size
server.max-http-header-size=65536
I have enabled Jersey multipart with register(MultiPartFeature.class);
.
It seems to me that Jersey is not picking up / not configured with the multipart values set via spring.servlet.multipart.*
. When I upload a large file to the application, it creates a corresponding /tmp/MIME*
file, and not into /tmp/tomcat
as specified in application.properties
.
It appears that Jersey by default expects a jersey-multipart-config.properties
file in WEB-INF/classes
where it can pick up properties.
I'd really like Jersey to pick up on the properties given in application.properties
. Is that possible, or will I have to accept that I need to manage multipart properties in a separate configuration file?
CodePudding user response:
The spring.servlet.multipart
applies to the MultipartResolver
support in Spring MVC. It will be registered with an MultipartConfigElement
which in turn will be added to any servlet available in the context (see the javadoc).
It won't apply to the jersey configuration as that is seperated and probably applies to a filter (in the end). You might be able to reuse the configuration properties or even obtain the pre-configured MultipartConfigElement
to obtain the configuration.
Nonetheless you will need to manually put in the configuration.