[jboss-dev-forums] [Design the new POJO MicroContainer] - beanfactory extensions
scott.stark@jboss.org
do-not-reply at jboss.com
Wed Mar 19 15:48:53 EDT 2008
I need to be able to do something like this to delegate ee container injection to the mc:
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| <beanfactory name="PooledFactoryType1"
| factoryClass="org.jboss.test.kernel.deployment.support.container.TestPooledBeanFactory"
| class="org.jboss.test.kernel.deployment.support.container.BeanType1">
| <property name="prop1">prop1DefaultValue</property>
| </beanfactory>
| <bean name="BeanContainerType1" class="org.jboss.test.kernel.deployment.support.container.BeanContainer">
| <property name="factory"><inject bean="PooledFactoryType1"/></property>
| </bean>
|
| <beanfactory name="PooledFactoryType2"
| factoryClass="org.jboss.test.kernel.deployment.support.container.TestPooledBeanFactory"
| class="org.jboss.test.kernel.deployment.support.container.BeanType2">
| <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
| </beanfactory>
| <bean name="BeanContainerType2" class="org.jboss.test.kernel.deployment.support.container.BeanContainer">
| <property name="factory"><inject bean="PooledFactoryType2"/></property>
| </bean>
|
| <bean name="BeanUser#1" class="org.jboss.test.kernel.deployment.support.container.BeanUser">
| <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
| <property name="bean2"><inject bean="BeanContainerType2" property="bean"/></property>
| </bean>
| <bean name="BeanUser#2" class="org.jboss.test.kernel.deployment.support.container.BeanUser">
| <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
| <property name="bean2"><inject bean="BeanContainerType2" property="bean"/></property>
| </bean>
| </deployment>
|
The only missing piece right now is not being able to set a factoryClass on a beanfactory.
The BeanContainer is only acting as a wrapper around the PooledFactoryType to expose the createBean method as a property. Arguably this can be dropped in factory of a factory injection notion that would call createBean() to obtain the injected value?
| <bean name="BeanUser#2" class="org.jboss.test.kernel.deployment.support.container.BeanUser">
| <property name="bean1"><inject factory="PooledFactoryType1" /></property>
| <property name="bean2"><inject factory="PooledFactoryType2"/></property>
| </bean>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137896#4137896
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137896
More information about the jboss-dev-forums
mailing list