Affects Version/s: 2.0
Fix Version/s: None
Operating System: All
In the 20090506 spec, ManagedProperty is very confusing for anyone familiar with
Java EE field and setter injections. In order to invoke the property setter, you
annotate a field--that's totally different from all other Java EE injections.
It gets worse. Suppose I have a property foo with methods getFoo/setFoo. As it
happens, I have no field foo. Now I want to inject a managed bean into this
property. I am forced into the unnatural act of adding a field, just so that I
can annotate the field in order to invoke the setter. Huh?
Minimally, change @ManagedProperty to annotate the setter instead of the field.
That captures its current semantics and surprises nobody.
Ideally, allow both field and setter injection. The semantics of field injection
should then be to reflectively inject the field, not to invoke the setter.