When I'm writing some spring xml configs, I personnally prefer to set default-autowire="byName".
But in Idea 14, the IDE warns me to "Make autowired dependencies explicit".
So here comes the question, whats the advantage of making spring bean wire explicit?
The main advantage is that you can review the object graph in a centralized way, as opposed to having to chase down dependencies distributed across a bunch of class files, component scans and so forth.
The disadvantage is that your app config is larger. More code/config to manage.
Either style works. I tend to start with autowiring and then migrate toward explicit dependencies as the app gets larger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With