2 ms·
"So if you like constructor injection you have two options: component scanning or XML." I totally disagree with this limitation. I do favor constructor injectio
by tobiasflohre 14y ago
"So if you like constructor injection you have two options: component scanning or XML."
I totally disagree with this limitation. I do favor constructor injection and I am always using it with Java based configuration, I never use setter injection (maybe sometimes for optional dependencies). Why should it be a problem that you need an instance for satisfying a dependency? It's only a problem if you have circular dependencies, but then something is wrong with your design.
All the rest is flavor we could discuss about for hours without getting to an end, but Spring's Java based configuration definitely doesn't have a problem with constructor injection.
Regards,
Tobias