Exception when running @ComponentScan in spring

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?

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


Write Answer

©2023 concretepage.com | Privacy Policy | Contact Us