Guice, Injecting TypeLiteral<T> when using @AssistedInject
问题 This works: public static class SomeGenericType<T> { private TypeLiteral<T> type; @Inject public SomeGenericType(TypeLiteral<T> type) { this.type = type; } public Class<? super T> getType() { return type.getRawType(); } } Guice automatically injects the TypeLiteral representing String when I do: @Inject SomeGenericType<String> foo; But when trying the same thing with Assisted Inject: public static interface FooFactory<T> { Foo<T> create(String name); } public static class Foo<T> {