On Thursday, October 31, 2013 7:20:25 PM UTC-4, Laszlo Ferenczi wrote: > > 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 > > Hi, Thank you for the example; it was very helpful. However, I do have a follow-up question. I understand that I can create a method annotated with @Provides that can create the desired object instance. In the above scenario, the client values are hardcoded, in my situation the underlying framework at bootup creates a configuration object to use with client construction. Can this configuration object be passed to the @Provides method within the AbstractModule implementation? If yes, how?
-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.
