This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
The second reason why setter injection is used a lot more often than you would expect, is the fact that frameworks like Spring in general, are much more suited to be configured by setter injection than by constructor injection. This is mostly because frameworks that need to be configured often contain lots of optional values. Making optional values configurable using constructor injection would lead to needless clutter and proliferating constructors, especially when used in combination with class inheritance.
Could anyone help me to understand above reason(I mean what is that optional values etc etc).
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
A setter method does not have to be called for your app to create instances. But with Constructor, you cannot create that object without its dependencies. With a setter method I can create that object without its dependencies. That makes them optional.
try creating a Mark without an OtherObject? You can't.