org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0:

Spring JIRA | Stepan Koltsov | 5 years ago
  1. 0

    @ComponentScan does not work in @Import-ed configuration. {code} public class Coin { } public class Main { @Configuration @ComponentScan(basePackageClasses = Main.class, useDefaultFilters = false, includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = Coin.class)) public static class Conf1 { } @Configuration @Import(Conf1.class) public static class Conf2 { } public static void main(String[] args) { System.out.println("loading Conf1"); // works fine new AnnotationConfigApplicationContext(Conf1.class).getBean(Coin.class); System.out.println("loading Conf2"); // cannot find a bean new AnnotationConfigApplicationContext(Conf2.class).getBean(Coin.class); System.out.println("Unreachable in Spring 3.1.0.M2"); } } {code} Outputs: {code} loading Conf1 loading Conf2 Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0: at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1101) at ru.yandex.commune.junk.stepancheg.spring.shinderuk.Main.main(Main.java:31) {code} Probably related to SPR-8307.

    Spring JIRA | 5 years ago | Stepan Koltsov
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0:
  2. 0

    @ComponentScan does not work in @Import-ed configuration. {code} public class Coin { } public class Main { @Configuration @ComponentScan(basePackageClasses = Main.class, useDefaultFilters = false, includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = Coin.class)) public static class Conf1 { } @Configuration @Import(Conf1.class) public static class Conf2 { } public static void main(String[] args) { System.out.println("loading Conf1"); // works fine new AnnotationConfigApplicationContext(Conf1.class).getBean(Coin.class); System.out.println("loading Conf2"); // cannot find a bean new AnnotationConfigApplicationContext(Conf2.class).getBean(Coin.class); System.out.println("Unreachable in Spring 3.1.0.M2"); } } {code} Outputs: {code} loading Conf1 loading Conf2 Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0: at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1101) at ru.yandex.commune.junk.stepancheg.spring.shinderuk.Main.main(Main.java:31) {code} Probably related to SPR-8307.

    Spring JIRA | 5 years ago | Stepan Koltsov
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0:
  3. 0

    SVN / if not used, exception are returned

    GitHub | 3 years ago | fxprunayre
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.fao.geonet.kernel.SvnManager] is defined: expected single bean but found 0:
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    exception stack trace is truncated

    GitHub | 3 years ago | kgignatyev
    java.lang.ExceptionInInitializerError
  6. 0

    GWT RequestFactory Error when firing request : org.springframework.beans.factory.NoSuchBeanDefinitionException

    Google Groups | 4 years ago | Radu Chilom
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.aievas.star.shared.services.StarRequestFactory$RaduRequestContext] is defined: expected single bean but found 0:

  1. Gatgeagent 4 times, last 2 months ago
  2. Pilleo 6 times, last 2 months ago
  3. qavid 2 times, last 6 months ago
  4. MrMonkey 3 times, last 8 months ago
  5. Piz 2 times, last 4 months ago
2 more registered users
19 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.beans.factory.NoSuchBeanDefinitionException

    No unique bean of type [ru.yandex.commune.junk.stepancheg.spring.shinderuk.Coin] is defined: expected single bean but found 0:

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean()
  2. Spring Beans
    DefaultListableBeanFactory.getBean
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269)
    1 frame
  3. Spring Context
    AbstractApplicationContext.getBean
    1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1101)
    1 frame
  4. ru.yandex.commune
    Main.main
    1. ru.yandex.commune.junk.stepancheg.spring.shinderuk.Main.main(Main.java:31)
    1 frame