When using @Autowired (not xml configuration), could someone compare the set/constructor binding advantages and disadvantages?
See the following examples:
It is entirely a matter of preference.
Spring frowns upon constructor injection, or at least used to, because thus circular dependencies appear and they are hard to manage (A needs B in constructor, B needs A in constructor).
One actual difference is that with @Autowired
on a field you don't need a setter method, which, on one hand makes the class smaller and easier to read, but on the other hand makes mocking the class a bit uglier.
I prefer the field injection.