-
1. Re: Bijection question: @IN(create=true)
cpopetz Jan 20, 2009 2:51 PM (in response to mpssantos.mpssantos.gmail.com)The binding is by name only, not by class. Seam looks for an object in the relevant context named 'pontonTransmission.' If it doesn't find one, it looks for a component registered (either through the @Name annotation or through components.xml) with the name 'pontonTransmission' and instantiates that class. Since only non-abstract classes can be registered, it knows exactly which class to instantiate. It then puts that result in the relevant context (unless it's stateless), and sets the injected field with the result as well. If the registered class for the name 'pontonTransmission' doesn't implement PontonTransmission, you'll get a ClassCastException at runtime when the injection occurs.
(There are possible complications to that scenario, e.g. you might have a @Factory for the name 'pontenTransmission' instead. But in the general case, the above description applies.)