Consider the dependency decalartion in Spring framework below copied from an article from
www.theserverside.com <beans>
<bean id="AirlineAgency" class="com.dnene.ditutorial.common.impl.SimpleAirlineAgency" singleton="true"/>
<bean id="CabAgency" class="com.dnene.ditutorial.common.impl.SetterBasedCabAgency" singleton="true">
<property name="airlineAgency">
<ref bean="AirlineAgency"/>
</property>
</bean>
<bean id="TripPlanner" class="com.dnene.ditutorial.common.impl.SetterBasedTripPlanner" singleton="true">
<property name="airlineAgency">
<ref bean="AirlineAgency"/>
</property>
<property name="cabAgency">
<ref bean="CabAgency"/>
</property>
</bean>
</beans>
Vu, In the example above , are you referring to case where cabagency may not always refer to airlineagency bean as conditional dependency ? If it is the case can't we have another declaration as above without the ref tag inside the cabagency tag ?

This will mean that there will multiple instances of cabagency , one with ref to airline agency and another without refernce to airline agency?
Karthick , since you have worked with Spring framework do you think this is possible.
Hope I am not

and also not confusing others.
I feel that there is too much hype surrounding dependency injection. :roll: