|
|
|
@ -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 {
|
|
|
|
|
|
|
|
|
|