Examples of containsSingleton()


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

    assertEquals("singletonObject", beanNames.next());
    assertFalse(beanNames.hasNext());
    assertEquals(2, beansOfType.size());

    assertTrue(lbf.containsSingleton("test"));
    assertTrue(lbf.containsSingleton("singletonObject"));
    assertTrue(lbf.containsBeanDefinition("test"));
    assertTrue(lbf.containsBeanDefinition("singletonObject"));
  }

  @Test
View Full Code Here

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

    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(bf).loadBeanDefinitions(SINGLETON_CONTEXT);
    bf.preInstantiateSingletons();

    ITestBean tb = (ITestBean) bf.getBean("proxy");
    assertFalse(bf.containsSingleton("target"));
    assertEquals(10, tb.getAge());
    assertTrue(bf.containsSingleton("target"));
  }

  @Test
View Full Code Here

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

    bf.preInstantiateSingletons();

    ITestBean tb = (ITestBean) bf.getBean("proxy");
    assertFalse(bf.containsSingleton("target"));
    assertEquals(10, tb.getAge());
    assertTrue(bf.containsSingleton("target"));
  }

  @Test
  public void testCustomLazyInitSingletonTargetSource() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
View Full Code Here

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

    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CUSTOM_TARGET_CONTEXT);
    bf.preInstantiateSingletons();

    ITestBean tb = (ITestBean) bf.getBean("proxy");
    assertFalse(bf.containsSingleton("target"));
    assertEquals("Rob Harrop", tb.getName());
    assertTrue(bf.containsSingleton("target"));
  }

  @Test
View Full Code Here

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

    bf.preInstantiateSingletons();

    ITestBean tb = (ITestBean) bf.getBean("proxy");
    assertFalse(bf.containsSingleton("target"));
    assertEquals("Rob Harrop", tb.getName());
    assertTrue(bf.containsSingleton("target"));
  }

  @Test
  public void testLazyInitFactoryBeanTargetSource() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
View Full Code Here

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

    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(bf).loadBeanDefinitions(FACTORY_BEAN_CONTEXT);
    bf.preInstantiateSingletons();

    Set<?> set1 = (Set<?>) bf.getBean("proxy1");
    assertFalse(bf.containsSingleton("target1"));
    assertTrue(set1.contains("10"));
    assertTrue(bf.containsSingleton("target1"));

    Set<?> set2 = (Set<?>) bf.getBean("proxy2");
    assertFalse(bf.containsSingleton("target2"));
View Full Code Here

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

    bf.preInstantiateSingletons();

    Set<?> set1 = (Set<?>) bf.getBean("proxy1");
    assertFalse(bf.containsSingleton("target1"));
    assertTrue(set1.contains("10"));
    assertTrue(bf.containsSingleton("target1"));

    Set<?> set2 = (Set<?>) bf.getBean("proxy2");
    assertFalse(bf.containsSingleton("target2"));
    assertTrue(set2.contains("20"));
    assertTrue(bf.containsSingleton("target2"));
View Full Code Here

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

    assertFalse(bf.containsSingleton("target1"));
    assertTrue(set1.contains("10"));
    assertTrue(bf.containsSingleton("target1"));

    Set<?> set2 = (Set<?>) bf.getBean("proxy2");
    assertFalse(bf.containsSingleton("target2"));
    assertTrue(set2.contains("20"));
    assertTrue(bf.containsSingleton("target2"));
  }

View Full Code Here

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

    assertTrue(bf.containsSingleton("target1"));

    Set<?> set2 = (Set<?>) bf.getBean("proxy2");
    assertFalse(bf.containsSingleton("target2"));
    assertTrue(set2.contains("20"));
    assertTrue(bf.containsSingleton("target2"));
  }


  @SuppressWarnings("serial")
  public static class CustomLazyInitTargetSource extends LazyInitTargetSource {
View Full Code Here

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

  public void testLazyInitSingletonTargetSource() {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitSingletonTests.xml", getClass()));
    bf.preInstantiateSingletons();

    ITestBean tb = (ITestBean) bf.getBean("proxy");
    assertFalse(bf.containsSingleton("target"));
    assertEquals(10, tb.getAge());
    assertTrue(bf.containsSingleton("target"));
  }

  public void testCustomLazyInitSingletonTargetSource() {
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.