Inject4Spring - opposite direction of references injection
Inject4Spring is a small Open Source library that extends base functionality of Spring framework by allowing wiring beans in Spring context using "opposite" direction comparing to standard Spring approach.
If we have, say, two beans defined within context, and first bean refers to other bean, that reference should be described within bean context configuration XML directly as part of referring bean definition. This is casual and "natural" Spring way of defining dependencies between beans.
However, for some types of applications that approach does not work. The major drawback of it is as follows: during definition of referring bean it's assumed that the name of bean to which it refers is known.
Therefore, to obtain truly extensible applications, we need to have ability to "extend" existing content of Spring context.
Inject4Spring provides ability to wire beans using "opposite" direction of references - something like that:
<bean name="InjectionBean" class="....">
<inject:to-ref target="InjectTarget" name="beanRefEmpty"/>
</bean>
or, for list (actually, reference, list, set and map based dependencies are supported by Inject4Spring)
<bean name="InjectionBean" class="...">
<inject:to-list target="InjectTarget" name="beansList"/>
</bean>
In other words, instead of having reference on bean that "REFERS" to another bean, with such notation we are able to specify that reference on bean declaration which is actually "REFERENDED" by another bean.
Well, that's just very short overview. Please refer to my blog for more details about that approach and for downloading Inject4Spring...
Oops, it seems that forum does not allow me to post URL... That's really sad...
Ok, sorry for that - you can more about Inject4Spring here
h t t p : //andrew.sazonov.name (funny, right? :mad:)
I hope you'll find that small library useful.
Regards,
Andrew Sazonov