File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes What's the advantage of using Spring's BeanFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "What Watch "What New topic
Author

What's the advantage of using Spring's BeanFactory

Mullin Yu
Greenhorn

Joined: Feb 24, 2005
Posts: 14
what's the advantage of using Spring's BeanFactory?

e.g.
public class SimpleFactoryBean implements FactoryBean {

public Class getObjectType() {
return TestBean.class;
}

public boolean isSingleton() {
return false;
}

public Object getObject() {
return new TestBean("Alef [factory]");
}
}
� and a small piece of XML:
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
FactoryBean is different from BeanFactory. BeanFactory is the lightweight container reference that you can use to get to the beans in the container. But FactoryBean is a bean that does not return a reference to itself but to an object it instantiates at run time. So when you inject a factory bean into bean X, the bean X will have a reference to the class instantiated by the factory bean and not the factory bean itself.


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
 
 
subject: What's the advantage of using Spring's BeanFactory
 
Threads others viewed
Return types from execute() method in struts2 action
Using properties file for defining class dependency
spring dependency injection not working with Selenium
ClassCast exception in lookup-method injection
Hibernate SaveOrUpdate
IntelliJ Java IDE