Let\'s say I have a module:
Module extends AbstractModule
{
@Override
protected void configure()
{
bind(String.class).
annotatedWith(Names.named(
I'm using the following method
public T getInstance(Class type, Class extends Annotation> option) {
final Key key = Key.get(type, option);
return injector.getInstance(key);
}
for this. In general, you still have the problem of creating the annotation instance, but here Names.named("annotation")
works.