Package org.springframework.context.support

Examples of org.springframework.context.support.StaticApplicationContext.refresh()


    sac.registerSingleton("noInterfaces", NoInterfaces.class);
    sac.registerSingleton("containerCallbackInterfacesOnly", ContainerCallbackInterfacesOnly.class);
    sac.registerSingleton("singletonNoInterceptor", TestBean.class);
    sac.registerSingleton("singletonToBeProxied", TestBean.class);
    sac.registerPrototype("prototypeToBeProxied", TestBean.class);
    sac.refresh();

    MessageSource messageSource = (MessageSource) sac.getBean("messageSource");
    NoInterfaces noInterfaces = (NoInterfaces) sac.getBean("noInterfaces");
    ContainerCallbackInterfacesOnly containerCallbackInterfacesOnly =
        (ContainerCallbackInterfacesOnly) sac.getBean("containerCallbackInterfacesOnly");
View Full Code Here


    sac.registerSingleton("noInterfaces", NoInterfaces.class);
    sac.registerSingleton("containerCallbackInterfacesOnly", ContainerCallbackInterfacesOnly.class);
    sac.registerSingleton("singletonNoInterceptor", TestBean.class);
    sac.registerSingleton("singletonToBeProxied", TestBean.class);
    sac.registerPrototype("prototypeToBeProxied", TestBean.class);
    sac.refresh();

    MessageSource messageSource = (MessageSource) sac.getBean("messageSource");
    NoInterfaces noInterfaces = (NoInterfaces) sac.getBean("noInterfaces");
    ContainerCallbackInterfacesOnly containerCallbackInterfacesOnly =
        (ContainerCallbackInterfacesOnly) sac.getBean("containerCallbackInterfacesOnly");
View Full Code Here

  public void testContextStartedEvent() {
    StaticApplicationContext context = new StaticApplicationContext();
    context.registerSingleton("lifecycle", LifecycleTestBean.class);
    context.registerSingleton("listener", LifecycleListener.class);
    context.refresh();
    LifecycleTestBean lifecycleBean = (LifecycleTestBean) context.getBean("lifecycle");
    LifecycleListener listener = (LifecycleListener) context.getBean("listener");
    assertFalse(lifecycleBean.isRunning());
    assertEquals(0, listener.getStartedCount());
    context.start();
View Full Code Here

  public void testContextStoppedEvent() {
    StaticApplicationContext context = new StaticApplicationContext();
    context.registerSingleton("lifecycle", LifecycleTestBean.class);
    context.registerSingleton("listener", LifecycleListener.class);
    context.refresh();
    LifecycleTestBean lifecycleBean = (LifecycleTestBean) context.getBean("lifecycle");
    LifecycleListener listener = (LifecycleListener) context.getBean("listener");
    assertFalse(lifecycleBean.isRunning());
    context.start();
    assertTrue(lifecycleBean.isRunning());
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.add("applicationEventClass", TestEvent.class.getName());
    // should automatically receive applicationEventPublisher reference
    ctx.registerSingleton("publisher", EventPublicationInterceptor.class, pvs);
    ctx.registerSingleton("otherListener", FactoryBeanTestListener.class);
    ctx.refresh();

    EventPublicationInterceptor interceptor =
        (EventPublicationInterceptor) ctx.getBean("publisher");
    ProxyFactory factory = new ProxyFactory(target);
    factory.addAdvice(0, interceptor);
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinition targetDefinition =
        new RootBeanDefinition(AsyncAnnotationBeanPostProcessorTests.TestBean.class);
    context.registerBeanDefinition("postProcessor", asyncAnnotationBeanPostProcessorDefinition);
    context.registerBeanDefinition("target", targetDefinition);
    context.refresh();
    return context;
  }


  private static interface ITestBean {
View Full Code Here

  @Test
  public void testAutoProxyCreatorWithFactoryBean() {
    StaticApplicationContext sac = new StaticApplicationContext();
    sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class);
    sac.registerSingleton("singletonFactoryToBeProxied", DummyFactory.class);
    sac.refresh();

    TestAutoProxyCreator tapc = (TestAutoProxyCreator) sac.getBean("testAutoProxyCreator");
    tapc.testInterceptor.nrOfInvocations = 0;

    FactoryBean<?> factory = (FactoryBean<?>) sac.getBean("&singletonFactoryToBeProxied");
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.add("singleton", "false");
    sac.registerSingleton("prototypeFactoryToBeProxied", DummyFactory.class, pvs);

    sac.refresh();

    TestAutoProxyCreator tapc = (TestAutoProxyCreator) sac.getBean("testAutoProxyCreator");
    tapc.testInterceptor.nrOfInvocations = 0;

    FactoryBean<?> prototypeFactory = (FactoryBean<?>) sac.getBean("&prototypeFactoryToBeProxied");
View Full Code Here

    pvs.add("proxyFactoryBean", "false");
    sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class, pvs);

    sac.registerSingleton("singletonFactoryToBeProxied", DummyFactory.class);

    sac.refresh();

    TestAutoProxyCreator tapc = (TestAutoProxyCreator) sac.getBean("testAutoProxyCreator");
    tapc.testInterceptor.nrOfInvocations = 0;

    FactoryBean<?> factory = (FactoryBean<?>) sac.getBean("&singletonFactoryToBeProxied");
View Full Code Here

    pvs = new MutablePropertyValues();
    pvs.add("singleton", "false");
    sac.registerSingleton("prototypeFactoryToBeProxied", DummyFactory.class, pvs);

    sac.refresh();

    TestAutoProxyCreator tapc = (TestAutoProxyCreator) sac.getBean("testAutoProxyCreator");
    tapc.testInterceptor.nrOfInvocations = 0;

    FactoryBean<?> prototypeFactory = (FactoryBean<?>) sac.getBean("&prototypeFactoryToBeProxied");
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.