I just commited a bunch of minor tweaks to autowiring. This should
ease peoples confusion as to why + when ColdSpring autowires beans
together.
First, some history. ColdSpring has always had autowiring forced on.
Why? I'm not completely sure. Regardless, this is not the norm and can
cause unexpected behavior. Thus, with the latest commit (and part of
1.0), autowiring is much cleaner & clearer:
1) We only support "byName" and "byType". byName will wire in beans
defined in the factory that match the setter/constructor arg name.
byType will wire up the first bean that matches the type of the setter
methood/constructor arg. Nothing else passes (including that hokey "if
the setter type matches a bean name" crap that was buried in previous
versions - don't ask!)
2) Support the default-autowire attribute. This means that as beans
are added to the factory, if default-autowire is defined within the
<beans/> tag, we set the autowire value on all beans within to be the
same (unless overridden by an individual bean definition). Like this:
<beans default-autowire="byName">
<bean id="bean1" class="bean1"/>
<bean id="bean2" class="bean2" autowire="no"/>
<bean id="bean3" class="bean3" autowire="byType"/>
</beans>
bean1 is byName, bean2 is not autowired, and bean3 is byType
3) For inner-beans, if they have autowire="..." defined, fine,
otherwise they inherit whatever their parent is set to.
For those interested in the actual changes to the framework, see:
http://code.coldspringframework.org:9010/changelog/Coldspring2/?cs=MAIN:rossd:20060420202443
thanks,
Dave