mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge pull request #6 from gregturn/BS-157
# By Greg Turnquist * BS-157: Add MultipartAutoConfigure to spring.factories
This commit is contained in:
commit
51f312f77d
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user