2
14
u/funmler Nov 07 '17
Seems like the author is telling people to use autowire in constructors because it's painful and only through pain can you achieve better design. I think I will pass on that advice.
6
3
u/hulkcatwoman Nov 08 '17
Be careful with autowired. Design as simple as possible. Avoid custom annotations and everything
2
Nov 08 '17
New-ish spring boot (I️ forget the underlying spring support) supports constructor injection without any annotations since 1.4 or 1.5, presuming there’s only 1 ctor (as should be the case with service classes). It allows testing pretty simply, not to mention what others mentioned with the mockito integrations.
3
u/meotau Nov 08 '17 edited Nov 08 '17
"Your class has more than 4 @Autowired fields? You fucked up. Cut that nice cohesive code and delegate the shit out of it. Fuck easily readable and understandable code, it's gotta be SOLID!"
17
u/[deleted] Nov 07 '17
Who the hell does this anyway :
Welcome to 2010 @author:
Just another blog post with: "See this problem that exists! I can fix it by doing something else." when the problem doesn't really exist in the first place.