All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.web.ServletWebMultipartAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.web;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.web.condition.ConditionalOnServletMultipartEnabled;

@SpringBootConfiguration
@ConditionalOnServletMultipartEnabled
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {org.springframework.web.multipart.support.StandardServletMultipartResolver.class, javax.servlet.MultipartConfigElement.class, javax.servlet.Servlet.class, org.springframework.web.servlet.DispatcherServlet.class})
public class ServletWebMultipartAutoConfiguration {

    public ServletWebMultipartAutoConfiguration() {
    }

    @Bean
    @ConditionalOnServletMultipartEnabled
    @ConditionalOnMissingBean(value = org.zodiac.core.web.config.MultipartConfigInfo.class)
    protected ServletMultipartConfigProperties multipartConfigProperties(MultipartProperties multipartProperties) {
        return new ServletMultipartConfigProperties().setEnabled(multipartProperties.getEnabled())
            .setFileSizeThreshold(multipartProperties.getFileSizeThreshold())
            .setLocation(multipartProperties.getLocation())
            .setMaxFileSize(multipartProperties.getMaxFileSize())
            .setMaxRequestSize(multipartProperties.getMaxRequestSize())
            .setResolveLazily(multipartProperties.isResolveLazily());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy