And I write these test code
===============================================
final List<TESTA> list = Lists.newArrayList();
list.add(new TESTA("1"));
list.add(new TESTA("2"));
list.add(new TESTA("3"));
list.add(new TESTA("4"));
list.add(new TESTA("5"));
list.add(new TESTA("6"));
Module ServiceModule = new AbstractModule() {
protected void configure() {
bind(Key.get(new TypeLiteral<List<TESTA>>() {},
UniqueAnnotations.create())).toInstance(list);
}
};
Injector injector = Guice.createInjector(Stage.DEVELOPMENT,
ServiceModule);
Key<List<TESTA>> key = Key.get(new TypeLiteral<List<TESTA>>() {});
List<TESTA> a = injector.getInstance(key);
===============================================
it not work,
but this works
===============================================
bind(Key.get(new TypeLiteral<List<TESTA>>() {})).toInstance(list);
===============================================
so what's the real different and why you binding
List<FilterDefinition> that way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---