diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java
index a54aa5aaf2..b79e147d43 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java
@@ -47,7 +47,7 @@ import org.springframework.web.servlet.DispatcherServlet;
@Configuration
@ConditionalOnClass({ Servlet.class, StandardServletMultipartResolver.class,
MultipartConfigElement.class })
-@ConditionalOnProperty(prefix = "multipart", name = "enabled", matchIfMissing = true)
+@ConditionalOnProperty(prefix = "spring.http.multipart", name = "enabled", matchIfMissing = true)
@EnableConfigurationProperties(MultipartProperties.class)
public class MultipartAutoConfiguration {
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java
index 396beb63b7..2c5b98a535 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,16 +25,16 @@ import org.springframework.util.StringUtils;
/**
* Properties to be used in configuring a {@link MultipartConfigElement}.
*
- * - {@literal multipart.location} specifies the directory where files will be stored.
- * The default is "". A common value is to use the system's temporary directory, which can
- * be obtained.
- * - {@literal multipart.maxFileSize} specifies the maximum size permitted for uploaded
- * files. The default is 1Mb.
- * - {@literal multipart.maxRequestSize} specifies the maximum size allowed for
- * {@literal multipart/form-data} requests. The default is 10Mb
- * - {@literal multipart.fileSizeThreshold} specifies the size threshold after which
- * files will be written to disk. Default is 0, which means that the file will be written
- * to disk immediately.
+ * - {@link #getLocation() location} specifies the directory where files will be
+ * stored. The default is "". A common value is to use the system's temporary directory,
+ * which can be obtained.
+ * - {@link #getMaxFileSize() max-file-size} specifies the maximum size permitted for
+ * uploaded files. The default is 1Mb.
+ * - {@link #getMaxRequestSize() max-request-size} specifies the maximum size allowed
+ * for {@literal multipart/form-data} requests. The default is 10Mb
+ * - {@link #getFileSizeThreshold() file-size-threshold} specifies the size threshold
+ * after which files will be written to disk. Default is 0, which means that the file
+ * will be written to disk immediately.
*
*
* These properties are ultimately passed through
@@ -45,13 +45,13 @@ import org.springframework.util.StringUtils;
* @author Josh Long
* @since 1.1.0
*/
-@ConfigurationProperties(prefix = "multipart", ignoreUnknownFields = false)
+@ConfigurationProperties(prefix = "spring.http.multipart", ignoreUnknownFields = false)
public class MultipartProperties {
/**
- * Enable multipart upload handling.
+ * Enable support of multi-part uploads.
*/
- private boolean enabled;
+ private boolean enabled = true;
/**
* Intermediate location of uploaded files.
diff --git a/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index 8b52e14b74..549db95ebc 100644
--- a/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -7,12 +7,6 @@
"replacement": "server.error.path"
}
},
- {
- "name": "multipart.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable support of multi-part uploads.",
- "defaultValue": true
- },
{
"name": "server.error.whitelabel.enabled",
"type": "java.lang.Boolean",
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java
index 4576bff6a9..409c220d95 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java
@@ -17,8 +17,6 @@
package org.springframework.boot.autoconfigure.web;
import java.net.URI;
-import java.util.LinkedHashMap;
-import java.util.Map;
import javax.servlet.MultipartConfigElement;
@@ -32,10 +30,10 @@ import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletConta
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.core.env.MapPropertySource;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpRequest;
@@ -170,10 +168,8 @@ public class MultipartAutoConfigurationTests {
private void testContainerWithCustomMultipartConfigEnabledSetting(
final String propertyValue, int expectedNumberOfMultipartConfigElementBeans) {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
- Map properties = new LinkedHashMap();
- properties.put("multipart.enabled", propertyValue);
- MapPropertySource propertySource = new MapPropertySource("test", properties);
- this.context.getEnvironment().getPropertySources().addFirst(propertySource);
+ EnvironmentTestUtils.addEnvironment(this.context,
+ "spring.http.multipart.enabled=" + propertyValue);
this.context.register(ContainerWithNoMultipartTomcat.class,
BaseConfiguration.class);
this.context.refresh();
diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
index 3ab9805862..4dfb9fb38c 100644
--- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
+++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
@@ -143,13 +143,6 @@ content into your application; rather pick only the properties that you need.
# WEB PROPERTIES
# ----------------------------------------
- # MULTIPART ({sc-spring-boot-autoconfigure}/web/MultipartProperties.{sc-ext}[MultipartProperties])
- multipart.enabled=true # Enable support of multi-part uploads.
- multipart.file-size-threshold=0 # Threshold after which files will be written to disk. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
- multipart.location= # Intermediate location of uploaded files.
- multipart.max-file-size=1Mb # Max file size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
- multipart.max-request-size=10Mb # Max request size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
-
# EMBEDDED SERVER CONFIGURATION ({sc-spring-boot-autoconfigure}/web/ServerProperties.{sc-ext}[ServerProperties])
server.address= # Network address to which the server should bind to.
server.compression.enabled=false # If response compression is enabled.
@@ -277,6 +270,13 @@ content into your application; rather pick only the properties that you need.
spring.http.encoding.enabled=true # Enable http encoding support.
spring.http.encoding.force=true # Force the encoding to the configured charset on HTTP requests and responses.
+ # MULTIPART ({sc-spring-boot-autoconfigure}/web/MultipartProperties.{sc-ext}[MultipartProperties])
+ spring.http.multipart.enabled=true # Enable support of multi-part uploads.
+ spring.http.multipart.file-size-threshold=0 # Threshold after which files will be written to disk. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
+ spring.http.multipart.location= # Intermediate location of uploaded files.
+ spring.http.multipart.max-file-size=1Mb # Max file size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
+ spring.http.multipart.max-request-size=10Mb # Max request size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
+
# JACKSON ({sc-spring-boot-autoconfigure}/jackson/JacksonProperties.{sc-ext}[JacksonProperties])
spring.jackson.date-format= # Date format string or a fully-qualified date format class name. For instance `yyyy-MM-dd HH:mm:ss`.
spring.jackson.default-property-inclusion= # Controls the inclusion of properties during serialization.
diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc
index 2531f2fc02..bdb8e60ffd 100644
--- a/spring-boot-docs/src/main/asciidoc/howto.adoc
+++ b/spring-boot-docs/src/main/asciidoc/howto.adoc
@@ -1211,7 +1211,7 @@ file and a maximum of 10Mb of file data in a single request. You may override th
values, as well as the location to which intermediate data is stored (e.g., to the `/tmp`
directory) and the threshold past which data is flushed to disk by using the properties
exposed in the `MultipartProperties` class. If you want to specify that files be
-unlimited, for example, set the `multipart.maxFileSize` property to `-1`.
+unlimited, for example, set the `spring.http.multipart.max-file-size` property to `-1`.
The multipart support is helpful when you want to receive multipart encoded file data as
a `@RequestParam`-annotated parameter of type `MultipartFile` in a Spring MVC controller