Dependency Injection - Java - Spring



Dependency Injection or (Inversion of Control)


1.1 Dependency

When we say about Dependency Injection , first we need to understand what is dependency?

Dependency, Its when one class is dependent on other....Very high level explanation ha ??

Let me explain you in a very simple way, with the following girl(Y) and boy(B) example.

As two friends are dependent on each other with the relation( Friendship ). Like wise, here if the girl(Y)  initiates an object of boy(B) then we say that, Y is dependent on B.

In that case we can't execute the class Y alone.(Because of Dependency).


























Advantages of not having Dependency
  • The class Y could be executed separately.
  • The class Y could be tested separately, since it is independent.


How Dependency Could be removed ?

----------------------------------------------------------------------------------------------------------
Sorry,

Under Maintenance














No comments

Thanks for viewing the blog post. Follow the blog to receive the updates.. Powered by Blogger.