Home  >  Forum  >  Spring
Post New Query

No unique bean of type is defined: expected single bean but found 0



Asked on April 24, 2013
Hi,
Help me for below error.

Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type is defined:
     expected single bean but found 0: 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1101)




Replied on April 24, 2013
error says that the bean you are trying to access has not bean loaded by spring container. Is that bean configure in spring XML?



Replied on April 24, 2013
I got the error, and yes you are correct, my problem was that I was accessing bean as 

getbean(BeanName.class)  

and there was two classes with BeanName  in my test application
and it was refferd by incorrect package.



Write Answer







©2019 concretepage.com | Privacy Policy | Contact Us