Add MultipartAutoConfigure to spring.factories

Update META-INF/spring.factories to include MultipartAutoConfigure.
Also tweaked the class @Conditionals and Javadoc.

Issue: BS-157
This commit is contained in:
Greg Turnquist 2013-06-20 14:32:49 -04:00 committed by Phillip Webb
parent 665d07ad74
commit db05637e06
2 changed files with 10 additions and 4 deletions

View File

@ -17,25 +17,30 @@
package org.springframework.bootstrap.autoconfigure.web;
import javax.servlet.MultipartConfigElement;
import javax.servlet.Servlet;
import org.springframework.bootstrap.context.annotation.ConditionalOnBean;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;
/**
* {@link EnableAutoConfiguration Auto-configuration} for multi-part uploads. It detects
* the existence of a {@link MultipartConfigElement} in the app context and then adds
* critical beans while also autowiring it into the Jetty/Tomcat embedded containers.
* {@link EnableAutoConfiguration Auto-configuration} for multi-part uploads. Adds a
* {@link StandardServletMultipartResolver} when a {@link MultipartConfigElement} bean is
* defined. The {@link EmbeddedWebApplicationContext} will associated the
* {@link MultipartConfigElement} bean to any {@link Servlet} beans.
*
* @author Greg Turnquist
*/
@Configuration
@ConditionalOnClass({ Servlet.class, StandardServletMultipartResolver.class })
@ConditionalOnBean(MultipartConfigElement.class)
public class MultipartAutoConfiguration {
@Bean
@ConditionalOnBean(MultipartConfigElement.class)
public StandardServletMultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}

View File

@ -10,6 +10,7 @@ org.springframework.bootstrap.autoconfigure.orm.jpa.HibernateJpaAutoConfiguratio
org.springframework.bootstrap.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.web.ServerPropertiesAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.web.MultipartAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration
# Application Context Initializers