Examples of initWebApplicationContext()


Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

 
  private WebApplicationContext beanFactory;

  public void init(ServletConfig config) throws ServletException {
    ContextLoader loader = new ContextLoader();   
    beanFactory = loader.initWebApplicationContext(config.getServletContext());
    super.init(config);
  }
 
  protected ServletServiceAdapterComponent buildRootComponent() {
    String araneaRoot = DEFAULT_ARANEA_ROOT;
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

public class SpringTapestryIntegrationTests extends TestCase {
    public void testSpringIntegration() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:org/springmodules/web/tapestry/applicationContext.xml");
        ContextLoader contextLoader = new ContextLoader();
        contextLoader.initWebApplicationContext(servletContext);

        MockServletConfig servletConfig = new MockServletConfig(servletContext, "servlet");
        ApplicationServlet servlet = new ApplicationServlet();
        servlet.init(servletConfig);
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

        super.setUp();
        ContextLoader contextLoader = new ContextLoader();
        servletContext = new MockServletContext();
        servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                                        getApplicationContextPath());
        applicationContext = contextLoader.initWebApplicationContext(servletContext);
    }

    /**
     * @return additional context, override to add more context files
     */
 
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

    ServletContext ctx = servletContext.getContext(webAppKey);
    if (ctx == null) {
      ctx = servletContext;
    }
    ContextLoader loader = new ContextLoader();
    ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) loader.initWebApplicationContext(ctx);
    appCtx.setParent(applicationContext);
    appCtx.refresh();

    ctx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCtx);
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class);

    MockServletContext servletContext = new MockServletContext();
    ContextLoader contextLoader = new ContextLoader(wac);
    contextLoader.initWebApplicationContext(servletContext);

    try {
      RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
      wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

    ServletContext ctx = servletContext.getContext(webAppKey);
    if (ctx == null) {
      ctx = servletContext;
    }
    ContextLoader loader = new ContextLoader();
    ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) loader
        .initWebApplicationContext(ctx);
    appCtx.setParent(applicationContext);
    appCtx.refresh();

    ctx.setAttribute(
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

    logger.debug("Path: " + prefix);

    try {
      // instance the context loader
      ContextLoader loader = createContextLoader();
      applicationContext = (ConfigurableWebApplicationContext) loader
          .initWebApplicationContext(servletContext);
      logger.debug("Root context path: "
          + applicationContext.getServletContext().getContextPath());

      ConfigurableBeanFactory factory = applicationContext
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

      return;
    }

    ContextLoader loader = new ContextLoader();

    ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) loader
        .initWebApplicationContext(ctx);
    appCtx.setParent(applicationContext);
    appCtx.refresh();

    ctx.setAttribute(
View Full Code Here

Examples of org.springframework.web.context.ContextLoader.initWebApplicationContext()

  public ApplicationContext loadContext(String... locations) throws Exception {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
        concatLocations(locations));
    ContextLoader contextLoader = new ContextLoader();
    return contextLoader.initWebApplicationContext(sc);
  }

  protected String concatLocations(String... locations) {
    if (locations == null || locations.length == 0)
      return "";
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener.initWebApplicationContext()

    WebApplicationContext rootAppContext = createRootApplicationContext();
    if ( rootAppContext != null ) {
      servletContext.setAttribute( DYNAMIC_INITIALIZER, this );

      ContextLoaderListener listener = new ShutdownOnlyContextLoaderListener( rootAppContext );
      listener.initWebApplicationContext( servletContext );
      servletContext.removeAttribute( DYNAMIC_INITIALIZER );

      servletContext.addListener( listener );
    }
    else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.