Hi all, I've now committed the constructor based autowiring in BuilderFactory as I previously described it. Go ahead and give it a try if you like. Updating the BuilderFactory documentation was by far the hardest part and I'm still not a 100% satisfied with it. Improvement suggestions are most welcome!
Cheers, --knut On Mon, 8 Nov 2004 15:08:49 +0100, Knut Wannheden <[EMAIL PROTECTED]> wrote: > Agreed, String is probably to common to be used for autowiring. There > is after all still the possibility to declare a setter for a > "serviceId" property which will be autowired. > > A detailed outline of the constructor autowiring strategy (which will > be employed iff "autowire-services" is "true" _and_ there are no > specified constructor parameters): > > 1. Gather all constructors which should be considered for autowiring. > This includes all constructors where all parameter types are > interfaces and none of the parameter types appears more than once. > Note that this also includes the default constructor. > 2. Order the considered constructors by length (given by number of > parameters). > 3. Iterate through the ordered list of constructors > 3.1 Match common parameter types (excluding String) as with current > autowiring and interfaces with registered service implementation. > a) For one or more service parameters there is no registered > implementation: Ignore silently and try next constructor (3). > b) For one or more service parameters there is more than one > registered service implementation: Log a warning and try next > constructor (3). > c) All parameters can be matched: Break (4). > 4. Instantiate implementation using found constructor. Throw > ApplicationRuntimeException if this fails or no constructor was found. > > Sounds reasonable? > > Note that setter based injection will occur regardless of whether > constructor based injection was employed or not. It solely depends on > the "autowire-services" property. > > --knut > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
