How can i make a program that supports dependency injection scenario, without using any framework and using xml files ?
Suppose
classA{
B b;
}
class B{
C c;
}
class C{
}
when class A requires of an object of class B , an xml file called AB.xml provide object of class B to the class A. When class B requires of an object of class C , an xml file called BC.xml provide object of class C to the class B. and so on..
please give me implementation of above scenario..
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32769
posted
0
XML is a data format - it can't "provide" anything without code (like a DI framework) that interprets it. Can you clarify what you mean by that? There are certainly DI frameworks -like OpenWebBeans- that work without the use of config files at least for the basic use cases.