Home  >  Forum  >  Spring
Post New Query

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


joined on
April 23,2013
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)

joined on
March 14,2013
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?
joined on
April 23,2013
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









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us