aspose file tools*
The moose likes Other Application Frameworks and the fly likes No bean named 'user' is defined Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "No bean named Watch "No bean named New topic
Author

No bean named 'user' is defined

Jo Askew
Greenhorn

Joined: Aug 13, 2011
Posts: 2

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

Joined: Oct 26, 2010
Posts: 198

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

Joined: Aug 13, 2011
Posts: 2

yep, everything is correct. I created a new project with the same configuration as above and everything went nice. No errors displayed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No bean named 'user' is defined
 
Similar Threads
DI - Beginners Question
JdbcTemplate and IllegalArgumentException
No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but
Database datasource bean: how to set properties at runtime?
JSF Spring integration