aspose file tools
The moose likes Spring and the fly likes dependency injection without use of framework? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "dependency injection without use of framework?" Watch "dependency injection without use of framework?" New topic
Author

dependency injection without use of framework?

purushottam singh
Greenhorn

Joined: Apr 06, 2011
Posts: 10

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
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.


Android appsImageJ pluginsJava web charts
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8845

I don't understand why you need so many xml files.


Groovy
 
 
subject: dependency injection without use of framework?
 
Threads others viewed
issues in Spring JMS integration with Glassfish
If singletons are bad, how does a factory help?
Use of depenedency injection
Help me in Java Reflection API
AnnotationDrivenConfig in Spring 3.0 with @Configuration
developer file tools