Hopefully this question is simple enough. I'm reading the Spring Framework Reference:beans-java section and I came across this usage example
The part that confuses me is the note at the end, specifically where it says
Note also that there is no need to specify @Autowired if the target bean defines only one constructor; in the example above, @Autowired is not necessary on the RepositoryConfig constructor.
I don't quite understand why I can remove @Autowired
from RepositoryConfig()
? What is the target bean in this case and what constructor are they referring to?
I attempted to reproduce this but the documentation doesn't provide the AccountRepository
class or the TransferService
class and I'm a noob so not sure what they should like look. So a reproducible example would be desirable.