[jboss-dev-forums] [JBoss Microcontainer Development] - Re: Supporting qualifiers in MC

kabir.khan@jboss.com do-not-reply at jboss.com
Tue Nov 24 11:12:49 EST 2009


"kabir.khan at jboss.com" wrote : 
  | The search algorithm works much the same as before. ClassAndQualifierKey queries for all the beans implementing a class, and then narrows it down depending on the wanted qualifiers and the required qualifiers.
  | EDIT: The qualifiers now are looked up from the MDR for the contexts involved
  | 
I forgot to mention that in the case of qualifier metadata existing at a higher level in MDR than instance level, the search takes that into account and merges whatever it can find at all levels. e.g., if ["a", "b"] exists at JVM level and ["c", "d"] at INSTANCE level, when doing the lookup for an instance ["a", "b", "c", "d"] is returned.

"kabir.khan at jboss.com" wrote : 
  | It should be possible to specify qualifiers for injected parameters and properties, so that in this example we can say the constructor wants the Bean with qualifier 'A' while the setter wants the Bean with the qualifier 'B'. I'll see if I can use/expand AbstractInjectionValueMetaData to use qualifiers.

I've done this. This differs from the bean-level qualifiers in that if a qualifier exists on an injection point, then the bean-level qualifiers are ignored, so the property level ones completely override the bean level ones e.g.


  | class TargetBean
  | {
  |    Bean bean1;
  | 
  |    Bean bean2;
  | }
  | 

If the bean has RelatedClassMetaData specifying that it's wanted qualifiers are 'A', and the property bean2 specifies that the qualifiers are 'B', for bean1 we will inject a bean that supplies the qualifier 'A', while for bean2 a bean that supplies the qualifier 'B' will be injected.

I don't know if the qualifiers for the injection points should be read from the MDR or not? At first glance doing that does not make sense since the component metadata lives below instance level, but I might be wrong. Especially if my previous assumption that injection point qualifiers should completely override the bean-level wanted qualifiers is wrong?

I'll add some xml configuration for everything before I commit

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

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



More information about the jboss-dev-forums mailing list