[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Field injection

adrian@jboss.org do-not-reply at jboss.com
Wed Mar 12 09:21:34 EDT 2008


"alesj" wrote : Scott is working on the EJBs where field injection is heavily used, and he needs this asap. :-)
  | 
  | From the distance it looks very similar to what we have with propertys.
  | e.g.
  | 
  |   | <bean name="mybean" class="org.jboss.acme.MyBean">
  |   |    <field name="somefield"><inject bean="somebean"/></field>
  |   |    <field name="mynumber" class="java.lang.Long">123456789</field>
  |   | </bean>
  |   | 
  | 

NO!!!!!! Do NOT add a field element to the bean metadata.

if you want to do field injection then these should be included in
the BeanInfo abstract as properties.

i.e. the property has the same name as the field and the
get/set operations work on the field joinpoints.
But only if the property has no relevant getter/setter.

I'd suggest that field injection should be enabled explicitly
by specifying some sort of access rule on the bean element/BeanMetaData
like JAXB does.
http://java.sun.com/javaee/5/docs/api/javax/xml/bind/annotation/XmlAccessType.html


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135927#4135927

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135927



More information about the jboss-dev-forums mailing list