use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ComponentScanParserBeanDefinitionDefaultsTests method testLazyInitTrue.
@Test
public void testLazyInitTrue() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultLazyInitTrueTests.xml");
assertTrue("lazy-init should be true", context.getBeanDefinition(TEST_BEAN_NAME).isLazyInit());
assertEquals("initCount should be 0", 0, DefaultsTestBean.INIT_COUNT);
context.refresh();
assertEquals("bean should not have been instantiated yet", 0, DefaultsTestBean.INIT_COUNT);
context.getBean(TEST_BEAN_NAME);
assertEquals("bean should have been instantiated", 1, DefaultsTestBean.INIT_COUNT);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ComponentScanParserBeanDefinitionDefaultsTests method testDefaultLazyInit.
@Test
public void testDefaultLazyInit() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
assertFalse("lazy-init should be false", context.getBeanDefinition(TEST_BEAN_NAME).isLazyInit());
assertEquals("initCount should be 0", 0, DefaultsTestBean.INIT_COUNT);
context.refresh();
assertEquals("bean should have been instantiated", 1, DefaultsTestBean.INIT_COUNT);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ComponentScanParserBeanDefinitionDefaultsTests method testLazyInitFalse.
@Test
public void testLazyInitFalse() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultLazyInitFalseTests.xml");
assertFalse("lazy-init should be false", context.getBeanDefinition(TEST_BEAN_NAME).isLazyInit());
assertEquals("initCount should be 0", 0, DefaultsTestBean.INIT_COUNT);
context.refresh();
assertEquals("bean should have been instantiated", 1, DefaultsTestBean.INIT_COUNT);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ComponentScanParserBeanDefinitionDefaultsTests method testDefaultDependencyCheck.
@Test
public void testDefaultDependencyCheck() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
context.refresh();
DefaultsTestBean bean = (DefaultsTestBean) context.getBean(TEST_BEAN_NAME);
assertNull("constructor dependency should not have been autowired", bean.getConstructorDependency());
assertNull("property dependencies should not have been autowired", bean.getPropertyDependency1());
assertNull("property dependencies should not have been autowired", bean.getPropertyDependency2());
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ComponentScanParserBeanDefinitionDefaultsTests method testAutowireNo.
@Test
public void testAutowireNo() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireNoTests.xml");
context.refresh();
DefaultsTestBean bean = (DefaultsTestBean) context.getBean(TEST_BEAN_NAME);
assertNull("no dependencies should have been autowired", bean.getConstructorDependency());
assertNull("no dependencies should have been autowired", bean.getPropertyDependency1());
assertNull("no dependencies should have been autowired", bean.getPropertyDependency2());
}
Aggregations