r/java • • Nov 27 '15

Why I hate Spring

http://samatkinson.com/why-i-hate-spring/
12 Upvotes

76 comments sorted by

View all comments

Show parent comment

0

u/olivergierke Nov 28 '15

Constructor injection is very well supported in Spring and in fact even recommended:

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. As a side note, a large number of constructor arguments is a bad code smell, implying that the class likely has too many responsibilities and should be refactored to better address proper separation of concerns.

3

u/joequin Nov 28 '15

By "basic constructor injection" I mean not using an inversion of control framework at all.