I have an abstract class AbstractTimerTask
that extends TimerTask
and I have a Jersey service that is going to manage these timer tasks. I will have more than one implementation of the abstract class, and I would like them all injected into the service. If possible, I would like to be able to inject them into a list of type List<AbstractTimerTask>
. It is possible that one or more of the child classes will not be available, depending on which jar files I deploy to the server. I would like only the child classes that are available to be injected. For this reason, I can't just list the classes in the service class as individual dependencies and build the list myself.
Is it possible to inject multiple classes with the same parent type into a list of that parent type?
You can inject IterableProvder<AbstractTimerTask>
, as seen in this answer