Search in sources :

Example 51 with AnnotationConfigServletWebServerApplicationContext

use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.

the class ServletWebServerFactoryAutoConfigurationTests method contextAlreadyHasDispatcherServlet.

@Test
public void contextAlreadyHasDispatcherServlet() throws Exception {
    this.context = new AnnotationConfigServletWebServerApplicationContext(SpringServletConfiguration.class, BaseConfiguration.class);
    verifyContext();
    assertThat(this.context.getBeanNamesForType(DispatcherServlet.class).length).isEqualTo(2);
}
Also used : AnnotationConfigServletWebServerApplicationContext(org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext) DispatcherServlet(org.springframework.web.servlet.DispatcherServlet) Test(org.junit.Test)

Example 52 with AnnotationConfigServletWebServerApplicationContext

use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext in project spring-boot by spring-projects.

the class ServletWebServerServletContextListenerTests method servletContextListenerBeanIsCalled.

private void servletContextListenerBeanIsCalled(Class<?> configuration) {
    AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(ServletContextListenerBeanConfiguration.class, configuration);
    ServletContextListener servletContextListener = context.getBean("servletContextListener", ServletContextListener.class);
    verify(servletContextListener).contextInitialized(any(ServletContextEvent.class));
    context.close();
}
Also used : ServletContextListener(javax.servlet.ServletContextListener) AnnotationConfigServletWebServerApplicationContext(org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext) ServletContextEvent(javax.servlet.ServletContextEvent)

Aggregations

AnnotationConfigServletWebServerApplicationContext (org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext)52 Test (org.junit.Test)41 DispatcherServlet (org.springframework.web.servlet.DispatcherServlet)8 BaseClientDetails (org.springframework.security.oauth2.provider.client.BaseClientDetails)7 ClientDetails (org.springframework.security.oauth2.provider.ClientDetails)6 Jsr250MethodSecurityMetadataSource (org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource)4 DelegatingMethodSecurityMetadataSource (org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource)4 MethodSecurityMetadataSource (org.springframework.security.access.method.MethodSecurityMetadataSource)4 ServerPortInfoApplicationContextInitializer (org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer)3 ServletContextEvent (javax.servlet.ServletContextEvent)2 ServletContextListener (javax.servlet.ServletContextListener)2 MethodSecurityExpressionHandler (org.springframework.security.access.expression.method.MethodSecurityExpressionHandler)2 PreInvocationAuthorizationAdvice (org.springframework.security.access.prepost.PreInvocationAuthorizationAdvice)2 PrePostAnnotationSecurityMetadataSource (org.springframework.security.access.prepost.PrePostAnnotationSecurityMetadataSource)2 OAuth2ClientContext (org.springframework.security.oauth2.client.OAuth2ClientContext)2 OAuth2MethodSecurityExpressionHandler (org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler)2 RestTemplate (org.springframework.web.client.RestTemplate)2 StandardServletMultipartResolver (org.springframework.web.multipart.support.StandardServletMultipartResolver)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1