Hi all,
I have a hierarchy of message handlers, where each concrete message handler
needs a specific message translator injected (following DDD principles):
abstract class MessageHandler<T> {
@Inject
protected T translator;
abstract void handle(Object object);
}
class MyMessageHandler extends MessageHandler<MyTranslator> {
void handle(Object object) {
DomainObject domainObject = translator.translate(object);
}
}
I would expect that HK2 would be able to resolve this injection, because,
when injecting into MyMessageHandler, T is already bound to MyTranslator.
However, I get the exception "Invalid injectee with required type of T
passed to getInjecteeDescriptor".
The handlers, as well as the translators, are all bound via
addActiveDescriptor(...).
Am I missing something here? Is this just a limitation of HK2's current
resolution mechanism, or is there some conceptual problem here?
Thanks for clarifying,
Mirko