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

Spring JIRA | Volodymyr Zhabiuk | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  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

    Yanel.getInstance().init() is still broken

    GitHub | 5 years ago | baszero
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'map' is defined
  6. 0

    SEVERE: Exception starting filter springSecurityFilterChain

    Stack Overflow | 2 years ago | jdev
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined

  1. Andreas Häber 1 times, last 3 weeks ago
  2. batwalrus76 1 times, last 3 months ago
  3. Luka 2 times, last 6 months ago
  4. mortalman7 11 times, last 8 months ago
  5. serious2monkeys 5 times, last 6 months ago
6 more registered users
53 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