"alesj" wrote :
| I'll ditch my crap and rewrite this to the upper features.
|
I've added FromContext to AbstractInjectionValueMetaData to handle injection form (Kernel|XYZ)ControllerContext.
| <bean name="set_name_bean" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="name"><inject fromContext="name"/></property>
| </bean>
|
| <beanfactory name="set_name_factory" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="name"><inject fromContext="name"/></property>
| </beanfactory>
|
| <bean name="metadata" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="metadata"><inject fromContext="metadata"/></property>
| </bean>
|
| <bean name="scopekey" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="scopeKey"><inject fromContext="scope"/></property>
| </bean>
|
| <bean name="dynamic" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="dynamic"><inject fromContext="getBeanMetaData"/></property>
| </bean>
|
| <bean name="other" class="org.jboss.test.kernel.deployment.support.NameAwareBean">
| <property name="name"><inject bean="set_name_bean" fromContext="name"/></property>
| </bean>
|
Currently there are these lookups / injections defined:
- name
- metadata
- scope
- id
- dynamic
If none of the first 4 is recognised, dynamic is used.
Dynamic tries to execute the getter method gained from the actual string value of fromContext attribute on the underlying context.
| public Object executeLookup(ControllerContext context) throws Throwable
| {
| Method method = findMethod(context.getClass());
| if (method == null)
| throw new IllegalArgumentException("No such getter on context class: " + getFromString());
| return ReflectionUtils.invoke(method, context, new Object[]{});
|
Is this dynamic OK to stay?
I added it to cover some exotic cases on-the-fly, but I can easily remove it. :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065125#4065125
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065125