Package org.springframework.beans.factory.support

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


    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("age", "99");
    lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
    TestBean tb = new TestBean();
    assertEquals(0, tb.getAge());
    lbf.configureBean(tb, "test");
    assertEquals(99, tb.getAge());
    assertSame(lbf, tb.getBeanFactory());
    assertNull(tb.getSpouse());
  }
View Full Code Here


    lbf.registerBeanDefinition("spouse", bd);
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("age", "99");
    lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_NAME));
    TestBean tb = new TestBean();
    lbf.configureBean(tb, "test");
    assertSame(lbf, tb.getBeanFactory());
    TestBean spouse = (TestBean) lbf.getBean("spouse");
    assertEquals(spouse, tb.getSpouse());
  }
View Full Code Here

    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
    bd.setPropertyValues(pvs);
    lbf.registerBeanDefinition("test", bd);
    TestBean tb = new TestBean();
    assertEquals(0, tb.getAge());
    lbf.configureBean(tb, "test");
    assertEquals(99, tb.getAge());
    assertSame(lbf, tb.getBeanFactory());
    assertNull(tb.getSpouse());
  }
View Full Code Here

    pvs.add("age", "99");
    RootBeanDefinition tbd = new RootBeanDefinition(TestBean.class);
    tbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_NAME);
    lbf.registerBeanDefinition("test", tbd);
    TestBean tb = new TestBean();
    lbf.configureBean(tb, "test");
    assertSame(lbf, tb.getBeanFactory());
    TestBean spouse = (TestBean) lbf.getBean("spouse");
    assertEquals(spouse, tb.getSpouse());
  }
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.