• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No bean named 'user' is defined

 
Jo Askew
Greenhorn
Posts: 2
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. I have a problem and can't understand it. What I'm trying to do is to create a working example to see the how the spring works. I have looked over examples, everything is correct, but I still get the `No bean named 'user' is defined` message in console.
I'm trying to create an instance of User class, with some properties seted in applicationContext.
I need help.

The entity:


The application context:


The main class:


The message in console:
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'user' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1087)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
at com.demo.MainClass.bla(MainClass.java:19)
at com.demo.MainClass.main(MainClass.java:12)

I'm using eclipse IDE.
Thanks
 
Sai Hegde
security forum advocate
Ranch Hand
Posts: 212
1
Android Flex Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applicationContext is not being found. Ensure that your context file name is the same as that you have referenced in your code. Except that everything else looks fine.
 
Jo Askew
Greenhorn
Posts: 2
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yep, everything is correct. I created a new project with the same configuration as above and everything went nice. No errors displayed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic