Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> avoid ugly things like Spring's autowiring of dependencies.

This seems awfully close to "avoid Spring" to me, heh.

Though, I've grown rather fond of Spring Boot over time, but I've gathered that's not exactly the popular consensus.



Spring is perfectly usable without `@Autowired`, at least outside of test classes. SonarQube has a rule that helps avoiding it. Just use constructor injection instead.


Constructor injection is still autowiring. Spring used to demand that you annotate constructor arguments with @Autowired but that changed some time ago.


No, it's the only sane technique to do dependency injection. And it still doesn't force you to do autowiring; you can also write a @Bean factory method for all components in the application if you really want.


Any form of dependency injection by classpath scanning is an antifeature


Classpath scanning is completely optional.


> This seems awfully close to "avoid Spring" to me, heh.

Exactly :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: