List of usage examples for org.springframework.beans.factory BeanNotOfRequiredTypeException getBeanName
public String getBeanName()
From source file:com.griddynamics.banshun.RegistryBeanTest.java
@Test public void importBeanWithSubclass() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( "com/griddynamics/banshun/registry/illegal-concrete-import.xml"); assertTrue("have no exports due to laziness", hasNoExports(ctx)); Object proxy = ctx.getBean("early-import"); // force export ctx.getBean("export-declaration"); try {/*from w ww .j av a2 s . co m*/ // target is ready here, but types does not match proxy.toString(); } catch (BeanNotOfRequiredTypeException e) { assertEquals("just-bean", e.getBeanName()); try { Object b = ctx.getBean("late-import").toString(); b.toString(); } catch (BeansException e2) { assertEquals("just-bean", ((BeanNotOfRequiredTypeException) e2).getBeanName()); return; } fail("we should have BeanCreactionException here"); return; } fail("we should have BeanNotOfRequiredTypeException here"); }