You should autowire interface AbstractManager
instead of class MailManager
. If you have different implemetations of AbstractManager
you can write @Component("mailService")
and then @Autowired @Qualifier("mailService")
combination to autowire specific class.
This is due to the fact that Spring creates and uses proxy objects based on the interfaces.