Re:Spring vs. Java EE
by tigershark on Sunday April 09, 2017 @08:37PM
(#14075142)
They are two different tools needed for two different jobs.
Constructor injection is for mandatory dependencies, setter injection is for optional dependencies.
If you are writing a plugin application and some modules are optional then you cannot use constructor injection because when the optional module is not present you cannot start your whole application.
In 99% of the cases obviously constructor injection is the way to go.
[ Parent
| on HN ]
There are no comments on this comment yet.