org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined

Spring JIRA | Volodymyr Zhabiuk | 9 years ago
  1. 0

    [SJC-54] Cannot find bean by name when using JavaConfigApplicationContext in the 1.0 m3 - Spring JIRA

    spring.io | 1 year ago
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined
  2. 0

    When I switched from version 1.0 M2 to 1.0 M3, I have failed to execute the following code ApplicationContext pac = new ClassPathXmlApplicationContext( CONFIGURATION_DATA_FILE); applicationContext = new JavaConfigApplicationContext(); applicationContext.setConfigClasses(ServicesBeanRepository.class, SystemBeanRepository.class); applicationContext.setParent(pac); applicationContext.refresh(); assertNotNull(applicationContext.getBean("customerService")); @Configuration public abstract class ServicesBeanRepository extends ConfigurationSupport { @Bean(autowire = Autowire.BY_TYPE) public CustomerService customerService() { CustomerService customerService = new CustomerServiceJpaImpl(); return customerService; } } In the version 1.0 M2 everything worked normally( I was using AnnotationApplicationContext instead of JavaConfigApplicationContext) And even when I switch to the deprecated AnnotationApplicationContext in the 1.0 M3 i have the same error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:391) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:999) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:227) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:883) at com.***.commerce.service.spi.local.***Services.getCustomerService(****Services.java:45) at com.***.commerce.service.spi.local.CustomerServiceJpaImplTest.beforeTest(CustomerServiceJpaImplTest.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Spring JIRA | 9 years ago | Volodymyr Zhabiuk
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined
  3. 0

    When I switched from version 1.0 M2 to 1.0 M3, I have failed to execute the following code ApplicationContext pac = new ClassPathXmlApplicationContext( CONFIGURATION_DATA_FILE); applicationContext = new JavaConfigApplicationContext(); applicationContext.setConfigClasses(ServicesBeanRepository.class, SystemBeanRepository.class); applicationContext.setParent(pac); applicationContext.refresh(); assertNotNull(applicationContext.getBean("customerService")); @Configuration public abstract class ServicesBeanRepository extends ConfigurationSupport { @Bean(autowire = Autowire.BY_TYPE) public CustomerService customerService() { CustomerService customerService = new CustomerServiceJpaImpl(); return customerService; } } In the version 1.0 M2 everything worked normally( I was using AnnotationApplicationContext instead of JavaConfigApplicationContext) And even when I switch to the deprecated AnnotationApplicationContext in the 1.0 M3 i have the same error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:391) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:999) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:227) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:883) at com.***.commerce.service.spi.local.***Services.getCustomerService(****Services.java:45) at com.***.commerce.service.spi.local.CustomerServiceJpaImplTest.beforeTest(CustomerServiceJpaImplTest.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Spring JIRA | 9 years ago | Volodymyr Zhabiuk
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    SEVERE: Exception starting filter springSecurityFilterChain

    Stack Overflow | 1 year ago | jdev
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
  6. 0

    Editor / Upload document does not work

    GitHub | 2 years ago | pvgenuchten
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [jeeves.server.context.ServiceContext] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

  1. Andreas Häber 4 times, last 1 month ago
  2. Luka 2 times, last 2 months ago
  3. mortalman7 11 times, last 4 months ago
  4. serious2monkeys 5 times, last 3 months ago
  5. Kawada 1 times, last 7 months ago
3 more registered users
52 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 bean named 'customerService' is defined

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition()
  2. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:391)
    2. org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:999)
    3. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
    4. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
    5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:227)
    6. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
    6 frames
  3. Spring Context
    AbstractApplicationContext.getBean
    1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:883)
    1 frame