Hi,

As simple as:

bind(IRiakClient.class).toInstance(client);

Create the client instance in the same module where the binding is.
If you'd like to use multiple instances just bind them with an annotation:

bind(IRiakClient.class).annotatedWith(MyAnnotation.class).toInstance(client);

@Inject
@MyAnnotation
IRiakClient client;

HTH


--
L


On Thu, Oct 31, 2013 at 10:05 PM, Ari King <[email protected]>wrote:

> Is it possible for Guice to create and manage a singleton configured class
> and inject were annotated? Essentially, I'd like Guice to create the
> following "client" with the associated configurations and inject that, and
> only that "client" as per annotations and type match.
>
> PBClientConfig conf = new PBClientConfig.Builder()
>                                         .withHost("127.0.0.1")
>                                         .withPort(8097)
>                                         .build();
>
> IRiakClient client = RiakFactory.newClient(conf);
>
>
> Thanks.
>
> -Ari
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to