[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: expressing dependent states
adrian@jboss.org
do-not-reply at jboss.com
Wed May 21 10:40:58 EDT 2008
You're breaking the MBean rules.
You shouldn't expect some dependency to be started in your create lifecycle.
I'm surprised this worked when you were an MBean? Maybe just luck :-)
The obvious solution would be to inject the ORBService as a parameter
into your create() method. It then must be started/installed to be passed
as such a parameter.
| <bean ...>
| <create>
| <parameter><inject bean="ORBService"/></parametrer>
| </create>
|
But if you don't want to change your code then you can use the "demand"
instead of "depends' to achieve what you want:
Example from the schema:
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/trunk/kernel/src/resources/main/schema/jboss-beans-common_2_0.xsd?view=log
| The demand is used to specify a dependency on a supply
|
| and when the demand should be supplied
|
|
|
| e.g.:
|
| ISupply must be installed before IDemand is constructed
|
|
|
| <bean name="IDemand">
|
| <demand state="Instantiated">theSupply</demand>
|
| </bean>
|
| <bean name="ISupply" ...>
|
| <supply>theSupply</supply>
|
| </bean>
|
In your case you would
| <demand state="Create">ORBService</demand>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152367#4152367
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152367
More information about the jboss-dev-forums
mailing list