Hi Freb,

I would prefer not to read from the db in a Provider method. I am trying to 
figure out how to inject an object that needs another object, that needs 
dynamic parameters so that I can avoid using "new".


Thanks,
Joseph
On Sunday, November 23, 2014 7:03:46 PM UTC-5, Fred Faber wrote:
>
> At some point you want to consider that wrapping db-reads in a Provider 
> method is hiding too much logic in an abstraction. Stay thin if you can.
>
> What would you gain with the injection?
>
> On Sun, Nov 23, 2014 at 11:49 AM, Joseph <[email protected] 
> <javascript:>> wrote:
>
>> Hello, 
>>
>> I need to make multiple objects of a client that takes a config object as 
>> a parameter. So for example, to do this using "new" I would do:
>>
>> Config conf = new Conf(123, 444, "whatever");
>>
>>
>> Client client = new Client(conf);
>>
>> I realize I can have a Provides method for Config and a Provides method 
>> for Client, that has Config injected, however, Config's parameters are not 
>> constant and not passed in the command line or a config file. They are 
>> constantly changing and from a db, and the row in the db is not constant, 
>> as I am making multiple objects. Config and Client are from third party 
>> libraries so I cannot add @Assisted to their constructors. 
>>
>>
>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/google-guice.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-guice/c3b1aab1-3ea0-45c7-a01e-71560766392b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-guice/c3b1aab1-3ea0-45c7-a01e-71560766392b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/ca354afc-c392-4d50-bb1b-3025c5e2d653%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to