use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class MultipartAutoConfigurationTests method webServerWithNoMultipartTomcatConfiguration.
@Test
public void webServerWithNoMultipartTomcatConfiguration() {
this.context = new AnnotationConfigServletWebServerApplicationContext(WebServerWithNoMultipartTomcat.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertThat(servlet.getMultipartResolver()).isNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)).hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
verifyServletWorks();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class MultipartAutoConfigurationTests method webServerWithNoMultipartJettyConfiguration.
@Test
public void webServerWithNoMultipartJettyConfiguration() {
this.context = new AnnotationConfigServletWebServerApplicationContext(WebServerWithNoMultipartJetty.class, BaseConfiguration.class);
DispatcherServlet servlet = this.context.getBean(DispatcherServlet.class);
assertThat(servlet.getMultipartResolver()).isNotNull();
assertThat(this.context.getBeansOfType(StandardServletMultipartResolver.class)).hasSize(1);
assertThat(this.context.getBeansOfType(MultipartResolver.class)).hasSize(1);
verifyServletWorks();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method contextAlreadyHasDispatcherServletAndRegistration.
@Test
public void contextAlreadyHasDispatcherServletAndRegistration() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(DispatcherServletWithRegistrationConfiguration.class, BaseConfiguration.class);
verifyContext();
assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length).isEqualTo(1);
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method initParametersAreConfiguredOnTheServletContext.
@Test
public void initParametersAreConfiguredOnTheServletContext() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "server.servlet.context-parameters.a:alpha", "server.servlet.context-parameters.b:bravo");
this.context.register(BaseConfiguration.class);
this.context.refresh();
ServletContext servletContext = this.context.getServletContext();
assertThat(servletContext.getInitParameter("a")).isEqualTo("alpha");
assertThat(servletContext.getInitParameter("b")).isEqualTo("bravo");
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method createFromConfigClass.
@Test
public void createFromConfigClass() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(BaseConfiguration.class);
verifyContext();
}
Aggregations