Examples of preInstantiateSingletons()


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

      public Object postProcessAfterInitialization(Object bean, String beanName) {
        return bean;
      }
    });
    BeanWithDestroyMethod.closed = false;
    lbf.preInstantiateSingletons();
    lbf.destroySingletons();
    assertTrue("Destroy method invoked", BeanWithDestroyMethod.closed);
  }

  public void testFindTypeOfSingletonFactoryMethodOnBeanInstance() {
View Full Code Here

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

    String beanName = "charlesDexterWard";
    BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class);

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    factory.registerBeanDefinition(beanName, testBean.getBeanDefinition());
    factory.preInstantiateSingletons();
    Object testBeanInstance = factory.getBean(beanName);

    MBeanExporter exporter = new MBeanExporter();
    exporter.setServer(getServer());
    Map beansToExport = new HashMap();
View Full Code Here

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

    String beanName = "charlesDexterWard";
    BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class);

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    factory.registerBeanDefinition(beanName, testBean.getBeanDefinition());
    factory.preInstantiateSingletons();
    Object testBeanInstance = factory.getBean(beanName);

    MBeanExporter exporter = new MBeanExporter();
    exporter.setServer(getServer());
    Map beansToExport = new HashMap();
View Full Code Here

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

  public void testProxy() throws Exception {
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
    reader.loadBeanDefinitions(new ClassPathResource("commonsPoolProxyTests.xml", getClass()));
    beanFactory.preInstantiateSingletons();
    ITestBean bean = (ITestBean)beanFactory.getBean("testBean");
    assertTrue(AopUtils.isAopProxy(bean));
  }
}
View Full Code Here

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

public class AutowireWithExclusionTests extends TestCase {

  public void testByTypeAutowireWithAutoSelfExclusion() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
    beanFactory.preInstantiateSingletons();
    TestBean rob = (TestBean) beanFactory.getBean("rob");
    TestBean sally = (TestBean) beanFactory.getBean("sally");
    assertEquals(sally, rob.getSpouse());
    assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
  }
View Full Code Here

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

  }

  public void testByTypeAutowireWithExclusion() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
    beanFactory.preInstantiateSingletons();
    TestBean rob = (TestBean) beanFactory.getBean("rob");
    assertEquals("props1", rob.getSomeProperties().getProperty("name"));
    assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
  }
View Full Code Here

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

  }

  public void testByTypeAutowireWithExclusionInParentFactory() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
    parent.preInstantiateSingletons();
    DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
    RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
    robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
    child.registerBeanDefinition("rob2", robDef);
View Full Code Here

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

  public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
    parent.getBeanDefinition("props1").setPrimary(true);
    parent.preInstantiateSingletons();
    DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
    RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
    robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
    child.registerBeanDefinition("rob2", robDef);
View Full Code Here

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

  }

  public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
    parent.preInstantiateSingletons();
    DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
    RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
    robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
    child.registerBeanDefinition("rob2", robDef);
View Full Code Here

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

  public void testByTypeAutowireWithPrimaryInParentAndChild() throws Exception {
    CountingFactory.reset();
    DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
    parent.getBeanDefinition("props1").setPrimary(true);
    parent.preInstantiateSingletons();
    DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
    RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
    robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
    robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
    child.registerBeanDefinition("rob2", robDef);
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.