resteasy / resteasy-spring-boot

Apache License 2.0
123 stars 51 forks source link

How to auto configure MultipartConfigElement? #315

Open mayur9991 opened 4 months ago

mayur9991 commented 4 months ago

Spring Boot includes MultipartAutoConfiguration, which automatically configures the MultipartConfigElement on the Spring Dispatcher Servlet.

Could you provide guidance on configuring this feature when using the Resteasy Spring Boot Starter?

liweinan commented 4 months ago

@mayur9991 I guess you are asking the MultipartConfigElement support in RESTEasy context. Here is how the RESTEasy uses the MultipartConfigElement:

if (multipartConfig != null) {
            reg.setMultipartConfig(new MultipartConfigElement(multipartConfig));
}
mayur9991 commented 4 months ago

I expected it to auto configure as spring does it with MultipartAutoConfiguration. However, that is not the case with resteasy-servlet-spring-boot-starter library.

liweinan commented 4 months ago

With my understanding the resteasy-spring-boot also uses the ServletInitializer internally from RESTEasy. I'll check this.

liweinan commented 4 months ago

I'm looking at the detail implementations between resteasy-spring-boot and resteasy and also the spring side. It may needs some time.

liweinan commented 3 months ago

I have checked the implementation of: https://github.com/resteasy/resteasy-spring-boot/blob/main/servlet/resteasy-servlet-spring-boot-starter/src/main/java/org/jboss/resteasy/springboot/ResteasyBeanProcessorTomcat.java

And seems it doesn't have the similar logic in:

        final MultipartConfig multipartConfig = applicationClass.getAnnotation(MultipartConfig.class);
        if (multipartConfig != null) {
            reg.setMultipartConfig(new MultipartConfigElement(multipartConfig));
        }

I will think about a solution on this.