List of usage examples for org.springframework.beans.factory BeanCreationException getResourceDescription
@Nullable
public String getResourceDescription()
From source file:org.springframework.beans.factory.xml.XmlBeanFactoryTests.java
/** * Test that if a custom initializer throws an exception, it's handled correctly *//*from w w w.j ava 2 s .com*/ @Test public void testInitMethodThrowsException() { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT); try { xbf.getBean("init-method2"); fail(); } catch (BeanCreationException ex) { assertTrue(ex.getResourceDescription().indexOf("initializers.xml") != -1); assertEquals("init-method2", ex.getBeanName()); assertTrue(ex.getCause() instanceof IOException); } }