Package org.springframework.web.context.support

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


    // Scan twice in order to find errors in the bean definition compatibility check.
    scanner.scan(getClass().getPackage().getName());
    scanner.scan(getClass().getPackage().getName());

    context.registerAlias("classPathBeanDefinitionScannerJsr330ScopeIntegrationTests.SessionScopedTestBean", "session");
    context.refresh();
    return context;
  }


   public static interface IScopedTestBean {
View Full Code Here


  @Test
  public void webApplicationContext() {
    GenericWebApplicationContext ctx = new GenericWebApplicationContext(newBeanFactoryWithEnvironmentAwareBean());
    assertHasStandardServletEnvironment(ctx);
    ctx.setEnvironment(prodWebEnv);
    ctx.refresh();

    assertHasEnvironment(ctx, prodWebEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodWebEnv);
  }
View Full Code Here

    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    GenericWebApplicationContext ctx = new GenericWebApplicationContext();
    ctx.setServletContext(servletContext);
    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


  private ConfigurablePortletApplicationContext initApplicationContext(String scope) {
    MockServletContext sc = new MockServletContext();
    GenericWebApplicationContext rac = new GenericWebApplicationContext(sc);
    rac.refresh();
    PortletContext pc = new ServletWrappingPortletContext(sc);
    StaticPortletApplicationContext ac = new StaticPortletApplicationContext();
    ac.setParent(rac);
    ac.setPortletContext(pc);
    GenericBeanDefinition bd = new GenericBeanDefinition();
View Full Code Here

    reader.setDefaultParentBean(this.defaultParentView);
    for (ResourceBundle bundle : bundles) {
      reader.registerBeanDefinitions(bundle);
    }

    factory.refresh();

    // Cache factory for both Locale and ResourceBundle list.
    if (isCache()) {
      this.localeCache.put(locale, factory);
      this.bundleCache.put(bundles, factory);
View Full Code Here

    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
    reader.setEnvironment(getApplicationContext().getEnvironment());
    reader.setEntityResolver(new ResourceEntityResolver(getApplicationContext()));
    reader.loadBeanDefinitions(actualLocation);

    factory.refresh();

    if (isCache()) {
      this.cachedFactory = factory;
    }
    return factory;
View Full Code Here

  public void testConfigureExporterParametersWithEncodingFromPropertiesFile() throws Exception {
    GenericWebApplicationContext ac = new GenericWebApplicationContext();
    ac.setServletContext(new MockServletContext());
    BeanDefinitionReader reader = new PropertiesBeanDefinitionReader(ac);
    reader.loadBeanDefinitions(new ClassPathResource("view.properties", getClass()));
    ac.refresh();

    AbstractJasperReportsView view = (AbstractJasperReportsView) ac.getBean("report");
    String encoding = (String) view.getConvertedExporterParameters().get(JRHtmlExporterParameter.CHARACTER_ENCODING);
    assertEquals("UTF-8", encoding);
View Full Code Here

        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(DoubleController.class));
        RootBeanDefinition mappingDef = new RootBeanDefinition(DefaultAnnotationHandlerMapping.class);
        mappingDef.getPropertyValues().add("useDefaultSuffixPattern", false);
        wac.registerBeanDefinition("handlerMapping", mappingDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

      @Override
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent)
          throws BeansException {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerclass));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
  }
View Full Code Here

        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(ImplicitSubPathController.class));
        RootBeanDefinition mappingDef = new RootBeanDefinition(DefaultAnnotationHandlerMapping.class);
        mappingDef.getPropertyValues().add("useDefaultSuffixPattern", false);
        wac.registerBeanDefinition("handlerMapping", mappingDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
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.