The basic principle of the the Di is that objects define their dependencies that is to say the other objects they work for only through constructor arguments, arguments to a factory method or properties which are set on the object instance after it has been constructed or returned from a factory method.
It is the job of the container to inject those dependencies when the bean is created which is inverse of what happens and hence the name IoC. In IoC bean itself is incontrol of instatiating ot locating its dependencies on its own using direct construction of classes or something else.
No comments:
Post a Comment