Thanks, Adrian.

So I would define my own factory with the parameters I need to
provide, inject this factory into my class and make sure I inject the
factory with whatever guice-provided object it needs. I guess the
value of the assisted annotation is that guice can then auto generate
the factory implementation for me.

I have been running away from DI bloat out there and guice looks more
and more, as I better understand it, a very useful and flexible DI
impl.

On Jul 6, 2:35 pm, Adrian Cole <[email protected]> wrote:
> I use Assisted Inject for this.  Basically, assisted inject lets you
> cooperate with guice to create objects.  Constructor parameters annotated
> with @Assisted are those you need to provide via a factory interface.
>
> I hope this helps.
> -Adrian
> jclouds
>
>
>
> On Mon, Jul 6, 2009 at 9:24 PM, Lemao <[email protected]> wrote:
>
> > After reading a bit more about Guice, maybe the right approach is to
> > define an explicit factory with a constructor receiving the global DI
> > object from Guice and a factory method receiving my contextual objects
> > to return a new instance. I would then inject the right objects and
> > the Injector itself into the factory constructor and inject the
> > factory into my classes.
>
> > Let me know if there is a better approach.
--~--~---------~--~----~------------~-------~--~----~
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