org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.abc.xyz.Engine] is defined: expected single matching bean but found 2: e1,e2 at org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor .postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support. bstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java:1214) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support. AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support. DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support. AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support. AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support. DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:772) at org.springframework.context.support. AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:839) at org.springframework.context.support. AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:139) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:83)

tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    @Qualifier() and @Autowired() not working

    Stack Overflow | 10 months ago | Shaik Yakhoob Ali
    org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.abc.xyz.Engine] is defined: expected single matching bean but found 2: e1,e2 at org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor .postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support. bstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java:1214) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support. AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support. DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support. AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support. AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support. DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:772) at org.springframework.context.support. AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:839) at org.springframework.context.support. AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:139) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:83)

    Root Cause Analysis

    1. org.springframework.beans.factory.NoUniqueBeanDefinitionException

      No qualifying bean of type [com.abc.xyz.Engine] is defined: expected single matching bean but found 2: e1,e2 at org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor .postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support. bstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java:1214) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support. AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support. AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support. DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support. AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support. AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support. DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:772) at org.springframework.context.support. AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:839) at org.springframework.context.support. AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:139) at org.springframework.context.support. ClassPathXmlApplicationContext.<init> (ClassPathXmlApplicationContext.java:83)

      at com.abc.xyz.ClientApp.main()
    2. com.abc.xyz
      ClientApp.main
      1. com.abc.xyz.ClientApp.main(ClientApp.java:9)
      1 frame