Dependency Injection in every aspect of a spring app?

Broadly speaking, an application is made up of a collection of classes that implement the business logic. Normally each object is responsible to obtain references of the objects it needs (and this object's dependencies). I think it is obvious that this leads to: 1) tightly coupled classes 2) code hard to test since each object instantiates specific classes it depends on and if there needs to be a change, the code must be modified.

So using Dependency Injections the objects do not instantiate the dependent objects themselves but an "external component" provides the dependencies at the object creation time i.e. Injects the dependencies into the objects. So in your example, the idea is that you can have for example a CsvRow object instantiated by Spring (along with all its dependencies) and get an object whenever needed.

It is also possible to switch to for example CsvRow2 object (another implementation) by just changing your configuration.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions