i am reading strutss 2 in action where they are integerating springs with struts. I am trying a lot but i am unable to understand what is dependency injection.
I am also not sure whether this question has to be post in springs forum or struts forum.
The nutshell version is that instead of an S2 action instantiating and using an implementation, like this:actions will instead allow the implementation to be instantiated and injected by Spring. This is generally defined in a configuration file, but there are other ways. So the code would look more like this:Amongst other things, this means that the action can now be tested with various user service implementations--like one that always fails login, one that always succeeds, or one that succeeds/fails based on user information, whatever.