[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Providing bean name aware feature
alesj
do-not-reply at jboss.com
Tue Jul 17 08:27:56 EDT 2007
"adrian at jboss.org" wrote : I thought I said not to add that xml config?
| You're not listening to any of my objections on this which has just led to all
| sorts of hacks and stupid configurations.
|
Yup.
I did respond I'll do them both though. :-(
The thing is people - like ThomasD - want to write as little code as possible to get name injected.
If he needs to write the whole
| <property name="name"><inject fromContext="name"/></property>
|
it's almost the same if he writes
| <property name="name">MyBeanName</property>
|
Even less chars on short names. :-)
But I agree auto-injection has its advantages. :-)
"adrian at jboss.org" wrote :
| 1) The name injection should be configured on a property
| e.g. something like
|
| | <property name="name"><inject fromContext="name"/></property>
| |
|
| You should be able to inject the bean name anywhere, e.g.
| on a parameter to the constructor
|
| | <constructor>
| | <parameter><inject fromContext="name"/></parameter>
| | </constructor>
| |
|
| and even potentially use it to resolve an alias to the real name
|
|
| | <inject bean="SomeAlias" fromContext="name"/>
| |
|
| 2) This just matches what should be doable and should be done via an annotation
|
| | @inject(fromContext="name")
| | public void setName(String name);
| |
|
Yup, I agree totally.
The parameter configuration should be there.
And I'm also not keen on
| <inject fromContext="name"/>
|
So that I don't screw it up for the Nth time, what should we use then? :-)
And I don't understand what you meant with alias usage?
"adrian at jboss.org" wrote :
| 3) The idea of hardwiring "setName" into the microcontainer code
| as some kind of default is just stupid.
| e.g. What if the bean already uses the "name" property for something else?
You should be aware that setName is not used for bean name, and you actually set name-method attribute.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064966#4064966
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4064966
More information about the jboss-dev-forums
mailing list