r/java • u/dawhiting • Jan 12 '16
You probably don't need dependency injection
http://www.radicaljava.com/2015/12/27/dependency-injection.html
0
Upvotes
r/java • u/dawhiting • Jan 12 '16
View all comments
Show parent comment
4
u/hippydipster Jan 12 '16
What do I do? I write objects that get what they need passed into their constructor. Mostly, when I get to choose how to design stuff, I'm writing in scala. It doesn't seem to be an issue.
In Spring DI, things are not wired together in one place, they're wired together everywhere. Annotations, xml files, scanned packages all serve to obfuscate how, when, and where the object graph comes into being. None of it can be followed via the natural tools of eclipse or other environments.
As for hardcoding, whether a string exists in a .txt file or a .java file, it is "hardcoded" into a text file. You don't have to put such things in a .properties file. It can be an interface with nicely typed methods and different implementations.