use of org.springframework.tests.sample.beans.TestBean in project spring-framework by spring-projects.
the class AutowireWithExclusionTests method byTypeAutowireWithAutoSelfExclusion.
@Test
public void byTypeAutowireWithAutoSelfExclusion() 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());
}
use of org.springframework.tests.sample.beans.TestBean in project spring-framework by spring-projects.
the class AutowireWithExclusionTests method byTypeAutowireWithExclusionInParentFactory.
@Test
public void byTypeAutowireWithExclusionInParentFactory() 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);
TestBean rob = (TestBean) child.getBean("rob2");
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
}
use of org.springframework.tests.sample.beans.TestBean in project spring-framework by spring-projects.
the class AutowireWithExclusionTests method byTypeAutowireWithInclusion.
@Test
public void byTypeAutowireWithInclusion() throws Exception {
CountingFactory.reset();
DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml");
beanFactory.preInstantiateSingletons();
TestBean rob = (TestBean) beanFactory.getBean("rob");
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
}
use of org.springframework.tests.sample.beans.TestBean in project spring-framework by spring-projects.
the class AutowireWithExclusionTests method byTypeAutowireWithExclusion.
@Test
public void byTypeAutowireWithExclusion() 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());
}
use of org.springframework.tests.sample.beans.TestBean in project spring-framework by spring-projects.
the class AutowireWithExclusionTests method byTypeAutowireWithSelectiveInclusion.
@Test
public void byTypeAutowireWithSelectiveInclusion() throws Exception {
CountingFactory.reset();
DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml");
beanFactory.preInstantiateSingletons();
TestBean rob = (TestBean) beanFactory.getBean("rob");
assertEquals("props1", rob.getSomeProperties().getProperty("name"));
assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
}
Aggregations