"scott.stark(a)jboss.org" wrote : So what is the benefit to BeanFactory over an
instance factory on the bean ctor metadata?
I wouldn't describe it as a benefit, its a different semantic.
Factory construction is just an alternate way to construct a singleton
| <bean>
| <constructor factroyClass="x.y.z.A"
factoryMethod="create"/>
|
A bean factory creates an object that implements BeanFactory
on which you can call create() to create as many instances as you like:
| <beanfactory name="MyFactory">
| ...
|
| public class MyClass
| {
| @Inject("MyFactory")
| public void setFactory(BeanFactory factory) {}
|
| public void doStuff()
| {
| Object one = factory.create();
| Object two = factory.create();
| }
| }
|
The main usecase of beanfactory so far has been to do dependency injection
into aop's advices.
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontaine...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136619#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...