Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.XmlWebApplicationContext.refresh()


    wac.getEnvironment().addActiveProfile("wacProfile1");
    wac.setParent(root);
    wac.setServletContext(sc);
    wac.setNamespace("test-servlet");
    wac.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/test-servlet.xml"});
    wac.refresh();
    return wac;
  }

  public void testEnvironmentMerge() {
    assertThat(this.root.getEnvironment().acceptsProfiles("rootProfile1"), is(true));
View Full Code Here


    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setParent(parent);
    wac.setServletContext(getServletContext());
    wac.setServletConfig(getServletConfig());
    wac.setNamespace(servletConfig.getServletName() + "-servlet");
    wac.refresh();

    Set<SpringBinding> bindings = new LinkedHashSet<SpringBinding>();

    // backward compatibility. recognize all bindings
    Map m = wac.getBeansOfType(SpringBindingList.class);
View Full Code Here

        final ConfigurableWebApplicationContext ctx = new XmlWebApplicationContext();
        ctx.setParent(getDefaultContext());
        ctx.setServletContext(getServletContext());
        ctx.setConfigLocation(contextConfigLocation);

        ctx.refresh();
        return ctx;
    }
}
View Full Code Here

    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setParent(applicationContext);
    wac.setServletContext(servletContext);
    wac.setConfigLocation("");
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    wac.refresh();
  }

  /**
   * 关闭ServletContext中的Spring WebApplicationContext.
   */
 
View Full Code Here

        final ConfigurableWebApplicationContext ctx = new XmlWebApplicationContext();
        ctx.setParent(getDefaultContext());
        ctx.setServletContext(getServletContext());
        ctx.setConfigLocation(contextConfigLocation);

        ctx.refresh();
        return ctx;
    }
}
View Full Code Here

    webApplicationContext.setServletContext(servletContext);
    webApplicationContext.setConfigLocations(files);
    servletContext
        .setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext);
    // Create beans
    webApplicationContext.refresh();

    this.applicationContext = webApplicationContext;

    // Initialize config
    this.config = (HDIVConfig) this.applicationContext.getBean(HDIVConfig.class);
View Full Code Here

        ConfigurableWebApplicationContext ac = new XmlWebApplicationContext();
        ServletContext msc = (ServletContext) new MockServletContext();
        msc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
        ac.setServletContext(msc);
        ac.setConfigLocations(new String[] {"org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml"});
        ac.refresh();
        StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory("constructor", null, null, null, msc, null, container);

        assertEquals(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, fac.getAutowireStrategy());
    }
View Full Code Here

        XmlWebApplicationContext context = new XmlWebApplicationContext();
        context.setServletContext(servletContext);
        context.setConfigLocations(new String[] {
            configuration
        });
        context.refresh();
        context.start();

        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

        return context;
View Full Code Here

  protected void setUp() throws Exception {
    MockServletContext sc = new MockServletContext("");
    XmlWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setServletContext(sc);
    wac.setConfigLocations(new String[]{"/net/buffalo/service/spring/applicationContext.xml"});
    wac.refresh();
    String key = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
    sc.setAttribute(key, wac);
   
    ssf = new SpringServiceFactory(sc);
   
View Full Code Here

  public void testGetFromSpring() throws Exception {
    MockServletContext sc = new MockServletContext("");
    XmlWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setServletContext(sc);
    wac.setConfigLocations(new String[]{"/net/buffalo/service/spring/applicationContext.xml"});
    wac.refresh();
    String key = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
    sc.setAttribute(key, wac);
   
    dsr = new DefaultServiceRepository(sc, noSerivceProp);
   
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.