List of usage examples for org.springframework.beans.factory.support DefaultListableBeanFactory setAllowCircularReferences
public void setAllowCircularReferences(boolean allowCircularReferences)
From source file:org.springframework.beans.factory.xml.XmlBeanFactoryTests.java
@Test public void testCircularReferencesWithNotAllowed() { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); xbf.setAllowCircularReferences(false); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); reader.loadBeanDefinitions(REFTYPES_CONTEXT); try {/*from ww w . j av a2 s . c o m*/ xbf.getBean("jenny"); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { assertTrue(ex.contains(BeanCurrentlyInCreationException.class)); } }