Hi,
I am new to Spring.
Please help in below doubts :
1. Which class/classes provide the implementation of getBean() method from BeanFactory interface ?
2. Is the getBean() method a factory method as in factory method design pattern.
Thanks
Hi,
I am new to Spring.
Please help in below doubts :
1. Which class/classes provide the implementation of getBean() method from BeanFactory interface ?
2. Is the getBean() method a factory method as in factory method design pattern.
Thanks
Welcome :-)
In my opinion the most important implementations of the BeanFactory[1] interface is all the different application context implementations.
Simplified you could see it as the interface that defines how to access beans from the context. See the Javadoc [1] for a complete list of implementing classes and a more detailed description of the BeanFactory.
Normally when you use spring you will not have to bother about the BeanFactory or the ApplicationContext since you can handle DI using annotations or the XML DSL.
Yes, I would say it is. Since it is the method you call to retrieve a bean from the application context. Depending on the bean definition it will return a singleton bean or build a new instance of the bean.
The reference manual [2] has good documentation on what the application context and bean factory is.
[1] http://static.springsource.org/sprin...anFactory.html
[2] http://static.springsource.org/sprin...tml/beans.html
Hope this helps
Pontus Ullgren
Last edited by ullgren; Aug 31st, 2012 at 05:08 AM.
@Pontus Ullgren
Thanks a lot![]()