Hacker News new | ask | show | jobs
by a_imho 2100 days ago
I am not sold on the premise that plumbing code is bad or not business logic, being explicit is no trouble, it is part of the story. How is writing a factory method worse than writing Spring configurations? Personally I prefer to write Java to Spring DSL.
1 comments

The point is you don't have to write the Spring configuration (except in the rare cases where you need to override with something specific). Just mark each class's constructor as @Autowired, make an AnnotationConfiguredApplicationContext passing the list of all your classes, and you don't have to manually keep track of which services need which other services - Spring takes care of instantiating everything in order and passing dependencies into the things that need them.