I have an interface:
public interface EmailSender {
void send(Locale locale, List<User> recipients, int ticketId);
}
And few different implementations, and I want to autowire a HashMap
of them, to have possibility to get concrete realization by class name, but when I write:
@Autowired
private HashMap<String, EmailSender> emailSenders;
I get an exception:
No qualifying bean of type 'java.util.HashMap'
@Autowired
private List<EmailSender> emailSenders;
It is interesting that whet I tried to change HashMap
to List
all worked fine, do you know how to correctly do that?