Package org.springframework.context.annotation

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


    @Override
    protected AbstractApplicationContext createApplicationContext() {
        AnnotationConfigApplicationContext springContext = new AnnotationConfigApplicationContext();
        springContext.register(SpringLdapTestConfiguration.class);
        springContext.refresh();
        return springContext;
    }

    @Override
    protected RouteBuilder createRouteBuilder() {
View Full Code Here


    @Test
    public void test() {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(GenericConfig.class);
        ctx.refresh();

        Map<String, Object> beans = ctx.getBeansWithAnnotation(org.springframework.stereotype.Service.class);
        System.out.println(beans);
    }
}
View Full Code Here

    //TODO: figure out how to make the unit tests not complain
    PropertyConfigurator.configure(PropertiesLoader.loadProperties(PROPERTIES_FILE_PATH));

    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
    applicationContext.register(DependencyConfig.class);
    applicationContext.refresh();
   
    logger.info("Initializing game engine.");

    Engine engine = applicationContext.getBean(Engine.class);
    engine.run();
View Full Code Here

  @Test
  public void withACAC() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.scan("com.example");
    ctx.refresh();
  }

}

@Component
View Full Code Here

  @Test
  public void contextBuilds() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(HighLevelContext.class);
    ctx.refresh();
  }

}
View Full Code Here

  @Test
  public void contextBuilds() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(LowLevelContext.class);
    ctx.refresh();
  }

}
View Full Code Here

  public void repro() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(ApplicationConfig.class);
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    context.refresh();
    assertNotNull(context.getBean(Foo.class));
    stopWatch.stop();
    System.out.println(stopWatch.prettyPrint());
    context.close();
  }
View Full Code Here

  public void repro() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ApplicationConfig.class);
    AnnotationConfigApplicationContext dispatcherCtx = new AnnotationConfigApplicationContext();
    dispatcherCtx.setParent(ctx);
    dispatcherCtx.register(DispatcherConfig.class);
    dispatcherCtx.refresh();

    assertTrue(ctx.containsLocalBean("fooBean"));
    assertFalse(ctx.containsLocalBean("fooController"));

    assertFalse(dispatcherCtx.containsLocalBean("fooBean"));
View Full Code Here

    PropertySource<?> ps = new JOptCommandLinePropertySource(options);

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.getEnvironment().getPropertySources().addLast(ps);
    ctx.register(Greeter.class);
    ctx.refresh();

    Greeter greeter = ctx.getBean(Greeter.class);
    greeter.sayGreeting();
  }
}
View Full Code Here

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

    Thread.sleep(10); // allow @Scheduled method to be called several times

    MyRepository repository = ctx.getBean(MyRepository.class);
    assertThat("repository is not a proxy", AopUtils.isAopProxy(repository), 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.