use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method contextAlreadyHasNonDispatcherServlet.
@Test
public void contextAlreadyHasNonDispatcherServlet() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(NonSpringServletConfiguration.class, BaseConfiguration.class);
// the non default servlet is still registered
verifyContext();
assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length).isEqualTo(0);
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method contextAlreadyHasDispatcherServletWithDefaultName.
@Test
public void contextAlreadyHasDispatcherServletWithDefaultName() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(DispatcherServletConfiguration.class, BaseConfiguration.class);
verifyContext();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method contextAlreadyHasNonServlet.
@Test
public void contextAlreadyHasNonServlet() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(NonServletConfiguration.class, BaseConfiguration.class);
assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length).isEqualTo(0);
assertThat(this.context.getBeanNamesForType(Servlet.class).length).isEqualTo(0);
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerFactoryAutoConfigurationTests method customizeWebServerFactoryThroughCallback.
@Test
public void customizeWebServerFactoryThroughCallback() throws Exception {
this.context = new AnnotationConfigServletWebServerApplicationContext(CallbackEmbeddedServerFactoryCustomizer.class, BaseConfiguration.class);
verifyContext();
assertThat(getWebServerFactory().getPort()).isEqualTo(9000);
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.
the class ServletWebServerServletContextListenerTests method registeredServletContextListenerBeanIsCalled.
private void registeredServletContextListenerBeanIsCalled(Class<?> configuration) {
AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(ServletListenerRegistrationBeanConfiguration.class, configuration);
ServletContextListener servletContextListener = (ServletContextListener) context.getBean("registration", ServletListenerRegistrationBean.class).getListener();
verify(servletContextListener).contextInitialized(any(ServletContextEvent.class));
context.close();
}
Aggregations