[jboss-user] [JBoss Microcontainer] New message: "Re: Undemanding Dependencies"
Adrian Brock
do-not-reply at jboss.com
Thu Jan 21 13:59:10 EST 2010
User development,
A new message was posted in the thread "Undemanding Dependencies":
http://community.jboss.org/message/521548#521548
Author : Adrian Brock
Profile : http://community.jboss.org/people/adrian@jboss.org
Message:
--------------------------------------------------------------
> mailto:david.lloyd at jboss.com wrote:
>
> > mailto:adrian at jboss.org wrote:
> >
> > Editor, ate my post again. ;-)
> >
> > Following the last comment, I'm not sure you wouldn't want more fine grained control on
> > which dependencies start your bean?
> >
> > <bean name="A" mode="On Demand">
> > <property name="b"><inject bean="B" transitive-start="true"/></property>
> > <bean>
> >
> > <bean name="B" mode="On Demand"/>
> Ah, that would be neat. Let me see if I can wrap my brain around that...
>
> So in this example, transitive-start would really mean that the targeted bean would control when this bean starts. So the question is, if you had two such injected bean properties, when would A start? When either injection is started, or only when both are?
You could make a configuration option, e.g. something like
Require both dependencies to start:
<bean name="A" mode="On Demand">
<property name="b"><inject bean="B" transitive-start="required"/></property>
<property name="c"><inject bean="C" transitive-start="required"/></property>
<bean>
Any one
<bean name="A" mode="On Demand">
<property name="b"><inject bean="B" transitive-start="optional"/></property>
<property name="c"><inject bean="C" transitive-start="optional"/></property>
<bean>
But unless starting A triggers some other knock-on effects, the second example is likely to stall with a missing dependency anyway. ;-)
So I think you'd probably want all the dependencies marked transitive-start anyway?
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/521548#521548
More information about the jboss-user
mailing list