diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index 1ea58c18c9f..13bd7a17385 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -567,7 +567,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac } @Override - protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class[] typesToMatch) { + protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class... typesToMatch) { Class beanClass; if (mbd.getFactoryMethodName() != null) { beanClass = getTypeForFactoryMethod(beanName, mbd, typesToMatch); diff --git a/org.springframework.web/src/main/java/org/springframework/http/HttpHeaders.java b/org.springframework.web/src/main/java/org/springframework/http/HttpHeaders.java index 90367678f88..2bc17bb2c7c 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/HttpHeaders.java +++ b/org.springframework.web/src/main/java/org/springframework/http/HttpHeaders.java @@ -318,7 +318,7 @@ public class HttpHeaders implements MultiValueMap { Assert.isTrue(eTag.startsWith("\"") || eTag.startsWith("W/"), "Invalid eTag, does not start with W/ or \""); Assert.isTrue(eTag.endsWith("\""), "Invalid eTag, does not end with \""); } - set(ETAG, eTag); + set(ETAG, eTag); } /** diff --git a/org.springframework.web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java b/org.springframework.web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java index 044fb7a833a..0bbe671083f 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java +++ b/org.springframework.web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java @@ -86,6 +86,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter> partConverters = new ArrayList>(); + public FormHttpMessageConverter() { this.supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED); this.supportedMediaTypes.add(MediaType.MULTIPART_FORM_DATA); @@ -97,13 +98,6 @@ public class FormHttpMessageConverter implements HttpMessageConverter partConverter) { - Assert.notNull(partConverter, "'partConverter' must not be NULL"); - this.partConverters.add(partConverter); - } /** * Set the message body converters to use. These converters are used to convert objects to MIME parts. @@ -113,6 +107,14 @@ public class FormHttpMessageConverter implements HttpMessageConverter partConverter) { + Assert.notNull(partConverter, "'partConverter' must not be NULL"); + this.partConverters.add(partConverter); + } + /** * Sets the character set used for writing form data. */ @@ -160,7 +162,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter getSupportedMediaTypes() { - return Collections.unmodifiableList(supportedMediaTypes); + return Collections.unmodifiableList(this.supportedMediaTypes); } public MultiValueMap read(Class> clazz, @@ -325,8 +327,9 @@ public class FormHttpMessageConverter implements HttpMessageConverterDefault implementation returns a random boundary. Can be overridden in - * subclasses. + * Generate a multipart boundary. + *

The default implementation returns a random boundary. + * Can be overridden in subclasses. */ protected byte[] generateMultipartBoundary() { byte[] boundary = new byte[rnd.nextInt(11) + 30]; @@ -337,10 +340,10 @@ public class FormHttpMessageConverter implements HttpMessageConverterDefault implementation returns {@link Resource#getFilename()} if the part is a {@code Resource}, and {@code null} - * in other cases. Can be overridden in subclasses. - * + * Return the filename of the given multipart part. This value will be used for the + * {@code Content-Disposition} header. + *

The default implementation returns {@link Resource#getFilename()} if the part is a + * {@code Resource}, and {@code null} in other cases. Can be overridden in subclasses. * @param part the part to determine the file name for * @return the filename, or {@code null} if not known */ @@ -354,6 +357,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter