Package org.springframework.web.context.support

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


  @Test
  public void xmlWebApplicationContext() {
    AbstractRefreshableWebApplicationContext ctx = new XmlWebApplicationContext();
    ctx.setConfigLocation("classpath:" + XML_PATH);
    ctx.setEnvironment(prodWebEnv);
    ctx.refresh();

    assertHasEnvironment(ctx, prodWebEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodWebEnv);
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
View Full Code Here


    servletConfig.addInitParameter("pConfig1", "pConfig1Value");

    AbstractRefreshableWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.setConfigLocation(EnvironmentAwareBean.class.getName());
    ctx.setServletConfig(servletConfig);
    ctx.refresh();

    ConfigurableEnvironment environment = ctx.getEnvironment();
    assertThat(environment, instanceOf(StandardServletEnvironment.class));
    MutablePropertySources propertySources = environment.getPropertySources();
    assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME), is(true));
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.