Package org.springframework.web.context.support

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


        log.info("Web application configuration");

        log.debug("Configuring Spring root application context");
        AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(ApplicationConfiguration.class);
        rootContext.refresh();

        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, rootContext);

        EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC);
View Full Code Here


    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.register(ThymeleafAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    MockServletContext servletContext = new MockServletContext();
    context.setServletContext(servletContext);
    context.refresh();
    ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class)
        .resolveViewName("view", Locale.UK);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
View Full Code Here

  @Test
  public void testOpenEntityManagerInViewInterceptorCreated() throws Exception {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
    context.refresh();
    assertNotNull(context.getBean(OpenEntityManagerInViewInterceptor.class));
    context.close();
  }

  @Test
View Full Code Here

      throws Exception {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.register(TestFilterConfiguration.class,
        EmbeddedDataSourceConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
    context.refresh();
    assertEquals(0, getInterceptorBeans(context).length);
    context.close();
  }

  @Test
View Full Code Here

      throws Exception {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(context, "spring.jpa.open_in_view:false");
    context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
    context.refresh();
    assertEquals(0, getInterceptorBeans(context).length);
    context.close();
  }

  @Test
View Full Code Here

  public void canBeUsedInNonGenericApplicationContext() throws Exception {
    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.setServletContext(new MockServletContext());
    context.register(Config.class);
    new AutoConfigurationReportLoggingInitializer().initialize(context);
    context.refresh();
    assertNotNull(context.getBean(ConditionEvaluationReport.class));
  }

  @Test
  public void noErrorIfNotInitialized() throws Exception {
View Full Code Here

        HibernateJpaAutoConfiguration.class,
        JpaRepositoriesAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class,
        RepositoryRestMvcAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(applicationContext, environment);
    applicationContext.refresh();
    this.context = applicationContext;
  }

  @Configuration
  @TestAutoConfigurationPackage(City.class)
View Full Code Here

    AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
    context.setEnvironment(env);
    context.setServletContext(new MockServletContext());
    context.register(TestShellConfiguration.class);
    context.register(CrshAutoConfiguration.class);
    context.refresh();

    PluginLifeCycle lifeCycle = context.getBean(PluginLifeCycle.class);
    String uuid = lifeCycle.getConfig().getProperty("test.uuid");
    assertEquals(TestShellConfiguration.uuid, uuid);
    context.close();
View Full Code Here

        parent.start();

        //the real main app context has a link to the parent context
        ctx.setParent(parent);
        ctx.register(MyAppSpringConfiguration.class);
        ctx.refresh();
        ctx.registerShutdownHook();
        ctx.start();

        //now that Spring is started, let's get all the beans that matter into DropWizard
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.