Package org.springframework.context.annotation

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext.refresh()


   */
  @Test
  public void clean() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(MainConfiguration.class);
    context.refresh();
    assertNotNull(context);
  }

  /**
   * This one is fails because it uses <code>@Import</code> (and
View Full Code Here


    @Test
    public void annotation() {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(Bar.class);
        ctx.refresh();
        Foo foo = ctx.getBean(Foo.class);
        assertNotNull(foo);
        ctx.close();
    }
View Full Code Here

   */
  @Test
  public void dirty() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(ImportConfiguration.class);
    context.refresh();
    assertNotNull(context);
  }

  @Configuration
  @Import({ DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
View Full Code Here

    @Test
    public void importResource() {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(Starter.class);
        ctx.refresh();
        Foo foo = ctx.getBean(Foo.class);
        assertNotNull(foo);
        ctx.close();
    }
View Full Code Here

    childContext.registerBeanDefinition(handlerClassName, beanDefinition);
    if (!kurentoApplicationContextExists()) {
      createKurentoApplicationContext(sc);
    }
    childContext.setParent(getKurentoApplicationContext());
    childContext.refresh();
    childContexts.put(servletClass.getName(), childContext);

    return childContext;
  }
View Full Code Here

  @Test
  public void afterConnectionEstablished() throws Exception {

    @SuppressWarnings("resource")
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.refresh();

    EchoHandler.reset();
    PerConnectionWebSocketHandler handler = new PerConnectionWebSocketHandler(EchoHandler.class);
    handler.setBeanFactory(context.getBeanFactory());
View Full Code Here

  @Test
  public void withFixedRateTask() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(FixedRateTaskConfig.class);
    ctx.refresh();

    Thread.sleep(100);
    assertThat(ctx.getBean(AtomicInteger.class).get(), greaterThanOrEqualTo(10));
    ctx.close();
  }
View Full Code Here

  @Test
  public void withSubclass() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(FixedRateTaskConfigSubclass.class);
    ctx.refresh();

    Thread.sleep(100);
    assertThat(ctx.getBean(AtomicInteger.class).get(), greaterThanOrEqualTo(10));
    ctx.close();
  }
View Full Code Here

  @Test
  public void withExplicitScheduler() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ExplicitSchedulerConfig.class);
    ctx.refresh();

    Thread.sleep(100);
    assertThat(ctx.getBean(AtomicInteger.class).get(), greaterThanOrEqualTo(10));
    assertThat(ctx.getBean(ExplicitSchedulerConfig.class).threadName, startsWith("explicitScheduler-"));
    ctx.close();
View Full Code Here

  @Test(expected=IllegalStateException.class)
  public void withExplicitSchedulerAmbiguity_andSchedulingEnabled() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(AmbiguousExplicitSchedulerConfig.class);
    try {
      ctx.refresh();
    } catch (IllegalStateException ex) {
      assertThat(ex.getMessage(), startsWith("More than one TaskScheduler"));
      throw ex;
    }
  }
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.