|
| Total Answers and Comments: 7 |
Last Update: October 19, 2009 Asked by: retheesh |
|
| | |
|
Submitted by: aparna210
Objects can be injected through setter or constructor. Dependency Injection means we can inject all the dependenciess to ur object in the xml file.
For example in order to establish connection ,Connection object needs datasource object.
So in the xml file first we declare a bean for DataSource ,in that we give parameters for connecting to database like url username passwordetc We delare another bean named Connection in which the above declared datasource object is injected through setter or constructor.
So at the time of startup the container reads the xml file. ann all the required objects are created without the developer explicitly creating objects.
Above answer was rated as good by the following members: geeky920 | Go To Top
|