File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "No bean named Watch "No bean named New topic

No bean named 'user' is defined

Jo Askew

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 (
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'user' is defined
at com.demo.MainClass.bla(
at com.demo.MainClass.main(

I'm using eclipse IDE.
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 204

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

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:
subject: No bean named 'user' is defined
It's not a secret anymore!