Dienstag, 15. Juli 2014

Why Spring makes me sick #2

From the Spring Framework Reference Documentation: "Most Spring users prefer actual JavaBeans with only a default (no-argument) constructor and appropriate setters and getters modeled after the properties in the container. You can also have more exotic non-bean-style classes in your container."

No one writes classes that have only default constructors - on the contrary, there are many reasons to write classes, that do not have a default constructor. And those are very common and thus far from exotic.

Update 16:25:
I just found that further down in the reference docs they write "The Spring team generally advocates constructor injection as it enables one to implement application components as immutable objects and to ensure that required dependencies are not null. Furthermore constructor-injected components are always returned to client (calling) code in a fully initialized state."

Yes, that's the way it is supposed to be (have been reading Joshua Bloch, haven't we?), but it totally contradicts the original statements...

Keine Kommentare:

Kommentar veröffentlichen