[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Bean instantiate order with contextual injection

adrian@jboss.org do-not-reply at jboss.com
Tue Aug 15 06:14:01 EDT 2006


"alesj" wrote : 
  | How to get to class in different parameter injection cases:
  | 
  | 
  |   |    <bean name="parameterObject1" class="org.jboss.test.kernel.inject.support.ParameterTestObject">
  |   |       <constructor>
  |   |          <parameter><array><inject/></array></parameter>
  |   |       </constructor>
  |   |    </bean>
  |   | 
  | 
  | Crawl back all to the constructorMD / parameterMD for some info which will help me in 'placeholder' dependency item?

That is more difficult. The current way it works is based on the
injected type deciding which method/constructor gets used
(by matching the passed types to the parameter types).

What you are trying to do is the reverse which currently has
no infrastructure to support it.

It is also an unsolvable problem in general:

e.g.

  | public class MyClass
  | {
  |     public MyClass(Type1 type1) {}
  |     public MyClass(Type2 type2) {}
  | }
  | 

Which type should I use Type1 or Type2?
The only way to resolve it would be:

  |          <parameter class="Type1"><inject/></parameter>
  | 

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

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



More information about the jboss-dev-forums mailing list