hi all,
i am new to spring.
so can anyone please guide me to any thread here in java ranch or can explain what does wiring means in Spring?
Sumeet H Singh
Greenhorn
Joined: Jan 03, 2009
Posts: 18
posted
0
Hi Prateek,
Wiring is the method by which you specify the relationships between various beans in your application i.e. if a bean A is dependent on another bean B, then the method of specifying that relationship is called wiring.
There are probably more that one ways of specifying the wiring mechanism, but I have come across only XML configuration till now..
Consider this example:
You have 2 classes- PrintNoClass & RandomNoGeneratorClass. The first class has the functionality for printing a random no, and its dependent on the second class for getting that no.
In Spring, you define the dependencies like this: (the code in red is where actual "wiring" is taking place)