Home  >  Forum  >  Spring
Post New Query

Exception when running @ComponentScan in spring


joined on
March 14,2013
Asked on March 16,2013
I am getting exception below.

In my application I am trying to use @ComponentScan to scan all beans. 

Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [someclass] 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)
    at com.concretepage.AppTest.main(AppTest.java:12)

Any clue?
joined on
March 14,2013
Replied on March 16,2013

Check that is your bean class annotated with

@Component.  As it is necessary if you are using  @ComponentScan. 

 

Find the link

http://www.concretepage.com/spring/example_componentscan_spring.php


Write Answer









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