@Test public void shouldNotIncludeTheApplicationContextOnTheRootApplicationContextParamIfAlreadySet() throws Exception { ConfigurableWebApplicationContext ctx = mock(ConfigurableWebApplicationContext.class); when(servletContext.getAttributeNames()).thenReturn(enumeration(Collections.<String> emptyList())); when(servletContext.getAttribute(ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).thenReturn(ctx); defaultExpectations(); SpringProvider provider = new SpringProvider(); provider.start(servletContext); verify(servletContext, never()).setAttribute(eq(ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE), isA(WebApplicationContext.class)); }
public void start(ServletContext context) { container = new SpringBasedContainer(getParentApplicationContext(context)); BasicConfiguration config = new BasicConfiguration(context); WebAppBootstrap bootstrap = new WebAppBootstrapFactory().create(config); bootstrap.configure(container); registerCustomComponents(container); container.start(context); }
SpringProvider implements ContainerProvider { public void start(ServletContext context) { container = new SpringBasedContainer(getParentApplicationContext(context)); BasicConfiguration config = new BasicConfiguration(context); WebAppBootstrap bootstrap = new WebAppBootstrapFactory().create(config); bootstrap.configure(container); registerCustomComponents(container); container.start(context); } }
SpringProvider implements ContainerProvider { public void start(ServletContext context) { container = new SpringBasedContainer(getParentApplicationContext(context)); BasicConfiguration config = new BasicConfiguration(context); WebAppBootstrap bootstrap = new WebAppBootstrapFactory().create(config); bootstrap.configure(container); registerCustomComponents(container); container.start(context); }  }
SpringProvider implements ContainerProvider { public void start(ServletContext context) { container = new SpringBasedContainer(getParentApplicationContext(context)); BasicConfiguration config = new BasicConfiguration(context); WebAppBootstrap bootstrap = new WebAppBootstrapFactory().create(config); bootstrap.configure(container); registerCustomComponents(container); container.start(context); }  T provideForRequest(RequestInfo request, Execution<T> execution); SpringBasedContainer getContainer(); void stop(); void start(ServletContext context); }
SpringProvider implements ContainerProvider { public void start(ServletContext context) { container = new SpringBasedContainer(getParentApplicationContext(context)); BasicConfiguration config = new BasicConfiguration(context); WebAppBootstrap bootstrap = new WebAppBootstrapFactory().create(config); bootstrap.configure(container); registerCustomComponents(container); container.start(context); }  T provideForRequest(RequestInfo request, Execution<T> execution); SpringBasedContainer getContainer(); void stop(); void start(ServletContext context);  }