use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class WebMvcAutoConfigurationTests method load.
private void load(Class<?> config, String... environment) {
this.context = new AnnotationConfigServletWebServerApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, environment);
List<Class<?>> configClasses = new ArrayList<>();
if (config != null) {
configClasses.add(config);
}
configClasses.addAll(Arrays.asList(Config.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class));
this.context.register(configClasses.toArray(new Class<?>[configClasses.size()]));
this.context.refresh();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class FilterOrderingIntegrationTests method load.
private void load() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.session.store-type=hash-map");
this.context.register(MockWebServerConfiguration.class, TestRedisConfiguration.class, WebMvcAutoConfiguration.class, SecurityAutoConfiguration.class, SessionAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, HttpEncodingAutoConfiguration.class);
this.context.refresh();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class MultipartAutoConfigurationTests method testWebServerWithCustomMultipartConfigEnabledSetting.
private void testWebServerWithCustomMultipartConfigEnabledSetting(final String propertyValue, int expectedNumberOfMultipartConfigElementBeans) {
this.context = new AnnotationConfigServletWebServerApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.http.multipart.enabled=" + propertyValue);
this.context.register(WebServerWithNoMultipartTomcat.class, BaseConfiguration.class);
this.context.refresh();
this.context.getBean(MultipartProperties.class);
assertThat(this.context.getBeansOfType(MultipartConfigElement.class)).hasSize(expectedNumberOfMultipartConfigElementBeans);
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class MultipartAutoConfigurationTests method configureResolveLazily.
@Test
public void configureResolveLazily() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.http.multipart.resolve-lazily=true");
this.context.register(WebServerWithNothing.class, BaseConfiguration.class);
this.context.refresh();
StandardServletMultipartResolver multipartResolver = this.context.getBean(StandardServletMultipartResolver.class);
boolean resolveLazily = (Boolean) ReflectionTestUtils.getField(multipartResolver, "resolveLazily");
assertThat(resolveLazily).isTrue();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class MultipartAutoConfigurationTests method webServerWithNoMultipartUndertowConfiguration.
@Test
public void webServerWithNoMultipartUndertowConfiguration() {
this.context = new AnnotationConfigServletWebServerApplicationContext(WebServerWithNoMultipartUndertow.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
verifyServletWorks();
assertThat(servlet.getMultipartResolver()).isNotNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)).hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
}
Aggregations