Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c90f5899
Commit
c90f5899
authored
Jun 20, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
7571f10a
e2d6280d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
pom.xml
spring-boot-project/spring-boot-autoconfigure/pom.xml
+5
-0
MultipartAutoConfiguration.java
...autoconfigure/web/servlet/MultipartAutoConfiguration.java
+4
-2
MultipartAutoConfigurationTests.java
...onfigure/web/servlet/MultipartAutoConfigurationTests.java
+21
-0
pom.xml
spring-boot-project/spring-boot-parent/pom.xml
+5
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/pom.xml
View file @
c90f5899
...
...
@@ -710,6 +710,11 @@
<artifactId>
logback-classic
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
commons-fileupload
</groupId>
<artifactId>
commons-fileupload
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.atomikos
</groupId>
<artifactId>
transactions-jms
</artifactId>
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfiguration.java
View file @
c90f5899
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -30,6 +30,7 @@ import org.springframework.boot.web.servlet.context.ServletWebServerApplicationC
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.multipart.MultipartResolver
;
import
org.springframework.web.multipart.commons.CommonsMultipartResolver
;
import
org.springframework.web.multipart.support.StandardServletMultipartResolver
;
import
org.springframework.web.servlet.DispatcherServlet
;
...
...
@@ -62,7 +63,8 @@ public class MultipartAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
({
MultipartConfigElement
.
class
,
CommonsMultipartResolver
.
class
})
public
MultipartConfigElement
multipartConfigElement
()
{
return
this
.
multipartProperties
.
createMultipartConfig
();
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java
View file @
c90f5899
...
...
@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartResolver
;
import
org.springframework.web.multipart.commons.CommonsMultipartResolver
;
import
org.springframework.web.multipart.support.StandardServletMultipartResolver
;
import
org.springframework.web.servlet.DispatcherServlet
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
...
...
@@ -184,6 +185,17 @@ public class MultipartAutoConfigurationTests {
.
getBean
(
MultipartResolver
.
class
);
assertThat
(
multipartResolver
)
.
isNotInstanceOf
(
StandardServletMultipartResolver
.
class
);
assertThat
(
this
.
context
.
getBeansOfType
(
MultipartConfigElement
.
class
)).
hasSize
(
1
);
}
@Test
public
void
containerWithCommonsMultipartResolver
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigServletWebServerApplicationContext
(
ContainerWithCommonsMultipartResolver
.
class
,
BaseConfiguration
.
class
);
MultipartResolver
multipartResolver
=
this
.
context
.
getBean
(
MultipartResolver
.
class
);
assertThat
(
multipartResolver
).
isInstanceOf
(
CommonsMultipartResolver
.
class
);
assertThat
(
this
.
context
.
getBeansOfType
(
MultipartConfigElement
.
class
)).
hasSize
(
0
);
}
@Test
...
...
@@ -351,6 +363,15 @@ public class MultipartAutoConfigurationTests {
}
public
static
class
ContainerWithCommonsMultipartResolver
{
@Bean
CommonsMultipartResolver
multipartResolver
()
{
return
mock
(
CommonsMultipartResolver
.
class
);
}
}
@Controller
public
static
class
WebController
{
...
...
spring-boot-project/spring-boot-parent/pom.xml
View file @
c90f5899
...
...
@@ -54,6 +54,11 @@
<artifactId>
log4j
</artifactId>
<version>
1.2.17
</version>
</dependency>
<dependency>
<groupId>
commons-fileupload
</groupId>
<artifactId>
commons-fileupload
</artifactId>
<version>
1.3.3
</version>
</dependency>
<dependency>
<groupId>
com.nhaarman
</groupId>
<artifactId>
mockito-kotlin
</artifactId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment