use of org.springframework.web.servlet.DispatcherServlet 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);
}
use of org.springframework.web.servlet.DispatcherServlet 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.web.servlet.DispatcherServlet 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.web.servlet.DispatcherServlet in project spring-framework by spring-projects.
the class DefaultMockMvcBuilderTests method dispatcherServletCustomizerProcessedInOrder.
@Test
public void dispatcherServletCustomizerProcessedInOrder() {
StubWebApplicationContext root = new StubWebApplicationContext(this.servletContext);
DefaultMockMvcBuilder builder = webAppContextSetup(root);
builder.addDispatcherServletCustomizer(ds -> ds.setContextId("test-id"));
builder.addDispatcherServletCustomizer(ds -> ds.setContextId("override-id"));
builder.dispatchOptions(true);
MockMvc mvc = builder.build();
DispatcherServlet ds = (DispatcherServlet) new DirectFieldAccessor(mvc).getPropertyValue("servlet");
assertEquals("override-id", ds.getContextId());
}
use of org.springframework.web.servlet.DispatcherServlet in project Activiti by Activiti.
the class JPAWebConfigurer method initSpring.
/**
* Initializes Spring and Spring MVC.
*/
private ServletRegistration.Dynamic initSpring(ServletContext servletContext, AnnotationConfigWebApplicationContext rootContext) {
log.debug("Configuring Spring Web application context");
AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();
dispatcherServletConfiguration.setParent(rootContext);
dispatcherServletConfiguration.register(DispatcherServletConfiguration.class);
log.debug("Registering Spring MVC Servlet");
ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet("dispatcher", new DispatcherServlet(dispatcherServletConfiguration));
dispatcherServlet.addMapping("/service/*");
dispatcherServlet.setLoadOnStartup(1);
dispatcherServlet.setAsyncSupported(true);
return dispatcherServlet;
}
Aggregations