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