Use this annotation in the bean implementation class
to make base interfaces of the bean be ignored from default
Let's consider an example:
Here IBase and IChild are interface, BaseImpl and MegaImpl are
implementation classes. Once you register BaseImpl and MegaImpl
as Spring beans you need to make either BaseImpl or MegaImpl
We are likely to make Spring autowire BaseImpl to all
dependencies that require IBase and to autowire MegaImpl to all
dependencies that require IChild. This would simplify runtime dependencies
of the application
Sill, the only possible solution with autowire-candidate='false'
make Spring autowire MegaImpl for all IChild and IBase dependencies.
It is also possible to use primary='true'
in BaseImpl declaration, in
order to implement right behaviour, but this approach does not scale
to the case you need to have more than 2 bean implementations
(i.e. we have MegaMegaImpl and IChildChild)
To use the annotation you need to add it to MegaImpl to declare
it should not be autowired for IBase interface dependency.
For more details on Spring see