As I got into the requirements of this more...turns out its even harder
than I thought.  It turns out different parts of the application will need
different pricing strategies at the same time, e.g. different functionality
will use different pricing strategies.

The good news is my app is 100% IoC so in the manual IoC way I would just
new up a separate instance that has been injected with the new pricing
scheme and all is good.  With Guice how do I do this?

In other words...I need two near top level object graphs...one injected
with A, B & C and another injected with X, Y & Z.  Currently I just have
one module file...is the solution to have two module files each defining
the bindings for each object graph?

How does Guice work?  Once it creates an instance from ModuleA does it
always get ALL its dependencies from that same ModuleA?  So what about
common objects that could be shared between the modules?  Do I need 3
module files, one for the shared bindings?  How do I link ModuleA & ModuleB
to ModuleShared?  Or maybe I just have duplicates of the
shared bindings...that shouldn't hurt.  Perhaps this isn't how Guice works
at all.

Guidance is greatly appreciated here.

-Dave

On Fri, Sep 14, 2012 at 11:02 AM, Cédric Beust ♔ <[email protected]> wrote:

> On Fri, Sep 14, 2012 at 9:57 AM, David Hoffer <[email protected]> wrote:
>
>> Regarding custom annotations...does that solve this?
>
>
> No, they are just a more type safe way of annotating your injections. I
> prefer this approach over @Named as a general rule because I don't like to
> rely on strings, but it's not always possible (e.g. if you use your own
> injection marker annotation, which can't take a generic enum as a
> parameter, only a specific one).
>
> --
> Cédric
>
>  --
> 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.
>

-- 
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.

Reply via email to