I have a SimpleCommand that has a String type Assisted injected:
Class SimpleCommand implements Executable{
private final ConfigManager config;
private String name;
@Inject
public SimpleCommand(ConfigManager config, @Assisted String name){
this.config = config;
this.name = name;
}
}
And I bind SimpleCommand to Executable as below:
Class MyModule extends AbstractModule{
@Override
protected void configure() {
bind(CommandFactory.class).toProvider(FactoryProvider.newFactory
(CommandFactory.class, SimpleCommand.class));
bind(Executable.class).to(SimpleCommand.class);
}
}
When I try to get SimpleCommnd instance using:
Guice.createInjector(new MyModule()).getInstance
(CommandFactory.class).create("sample command");
I got such error:
1) No implementation for java.lang.String annotated with
@com.google.inject.assistedinject.Assisted(value=) was bound.
while locating java.lang.String annotated with
@com.google.inject.assistedinject.Assisted(value=)
for parameter 2 at model.Command.<init>(SimpleCommand.java:58)
at module.MyModule.configure(MyModule.java:34)
Could any one help me?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---