Hello,
I have the following Provider class:
public class GuiceResourceProvider implements Provider<WebResource> {
@Inject
private Configuration configuration;
@Inject
private Environment environment;
private String name;
@Inject
public GuiceResourceProvider(@Assisted("name") String name) {
this.name = name;
}
@Override
public WebResource get() {
if (name == "default") {
String connectionsDSResourceUrl = "http://localhost:" +
this.configuration.getHttpConfiguration().getPort();
Client connectionsDSHttpClient = new
JerseyClientBuilder().using(this.configuration.getHttpClientConfiguration()).using(this.environment).build();
connectionsDSHttpClient.addFilter(new RequestIdClientFilter());
return
connectionsDSHttpClient.resource(connectionsDSResourceUrl);
} else if (name == "other"){
return ..........
}
}
I need to pass both injected and assisted parameters when binding. The
injected parameters work as expected but i have a problem figuring out how
to additionally pass something by me. If i use a binding to an instance, i
loose the injected parameters. I tried to use AssistedInject as i do with
other types, but it comes down to injecting the factory in my Guice Module
which seems, of course, off!!!
Is this even possible?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.