Examples of destroySingletons()


Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons()

    CustomAnnotationOptionalMethodResourceInjectionBean bean = (CustomAnnotationOptionalMethodResourceInjectionBean) bf.getBean("customBean");
    assertSame(tb, bean.getTestBean3());
    assertNull(bean.getTestBean());
    assertNull(bean.getTestBean2());
    bf.destroySingletons();
  }

  public void testCustomAnnotationOptionalMethodResourceInjectionWhenNoDependencyFound() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons()

    CustomAnnotationOptionalMethodResourceInjectionBean bean = (CustomAnnotationOptionalMethodResourceInjectionBean) bf.getBean("customBean");
    assertNull(bean.getTestBean3());
    assertNull(bean.getTestBean());
    assertNull(bean.getTestBean2());
    bf.destroySingletons();
  }

  public void testCustomAnnotationOptionalMethodResourceInjectionWhenMultipleDependenciesFound() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons()

      fail("expected BeanCreationException; multiple beans of dependency type available");
    }
    catch (BeanCreationException e) {
      // expected
    }
    bf.destroySingletons();
  }

  /**
   * Verifies that a dependency on a {@link FactoryBean} can be autowired via
   * {@link Autowired @Autowired}, specifically addressing the JIRA issue
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons()

    assertNotNull("The singleton StringFactoryBean should have been registered.", factoryBean);
    assertNotNull("The factoryBeanDependentBean should have been registered.", bean);
    assertEquals("The FactoryBeanDependentBean should have been autowired 'by type' with the StringFactoryBean.",
        factoryBean, bean.getFactoryBean());

    bf.destroySingletons();
  }


  public static class ResourceInjectionBean {
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons()

    assertEquals(2, beanRegistry.getSingletonCount());
    assertEquals(2, beanRegistry.getSingletonNames().length);
    assertTrue(Arrays.asList(beanRegistry.getSingletonNames()).contains("tb"));
    assertTrue(Arrays.asList(beanRegistry.getSingletonNames()).contains("tb2"));

    beanRegistry.destroySingletons();
    assertEquals(0, beanRegistry.getSingletonCount());
    assertEquals(0, beanRegistry.getSingletonNames().length);
  }

  public void testDisposableBean() {
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons()

    assertEquals(1, beanRegistry.getSingletonCount());
    assertEquals(1, beanRegistry.getSingletonNames().length);
    assertTrue(Arrays.asList(beanRegistry.getSingletonNames()).contains("tb"));
    assertFalse(tb.wasDestroyed());

    beanRegistry.destroySingletons();
    assertEquals(0, beanRegistry.getSingletonCount());
    assertEquals(0, beanRegistry.getSingletonNames().length);
    assertTrue(tb.wasDestroyed());
  }
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.destroySingletons()

       
        DestructiveBean bean = (DestructiveBean) factory.getBean("destructiveBean");
       
        System.out.println("Calling destroySingletons()");
        factory.destroySingletons();
        System.out.println("Called destroySingletons()");
    }
}
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.destroySingletons()

                        "./ch5/src/conf/lifecycle/disposeInterface.xml"));

        DestructiveBeanWithInterface bean = (DestructiveBeanWithInterface) factory.getBean("destructiveBean");

        System.out.println("Calling destroySingletons()");
        factory.destroySingletons();
        System.out.println("Called destroySingletons()");

    }

}
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.destroySingletons()

      assertNotNull(instance);
      instance = server.getObjectInstance(ObjectNameManager.getInstance("spring:mbean3=true"));
      assertNotNull(instance);
    }
    finally {
      bf.destroySingletons();
    }
  }

  public void testAutodetectWithExclude() throws Exception {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectMBeans.xml", getClass()));
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.destroySingletons()

      }
      catch (InstanceNotFoundException expected) {
      }
    }
    finally {
      bf.destroySingletons();
    }
  }

  public void testAutodetectLazyMBeans() throws Exception {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectLazyMBeans.xml", getClass()));
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.