Hi all,

Thanks for the suggestions.

I also saw this:

  
http://code.google.com/p/google-guice/wiki/ModulesShouldBeFastAndSideEffectFree

so I think I'll follow the side effect free approach.

Thank you,

Mark

On May 2, 12:03 pm, Fred Faber <[email protected]> wrote:
> Yes, Guice can be used in the model that an Injector represents the
> container in which objects of an app are configured and instantiated.
>  That's a good way to go for a large set of cases.
>
> An extension thereof is to use Guice to handle lifecycles as well.  To
> handle an initialization-based lifecycle, it's convenient to use the
> Service<http://code.google.com/p/guava-libraries/source/browse/trunk/src/com/...>class,
> and especially the
> AbstractService<http://www.google.com/codesearch/p?hl=en#UKMs0lhE9bg/trunk/src/com/go...>template.
>   These classes are included in the Google
> Guava <http://code.google.com/p/guava-libraries/>libraries.
>
> A basic pattern to follow is to create a Set<Service> using a multibinder,
> and then inject that into your main class or an application entry point.
>  Something as simple as that typically does the trick.  This is preferred
> over using initialization in modules because of the intrinsic multithreading
> you can achieve with AbstractService subclasses.
>
> Fred
>
>
>
>
>
>
>
> On Mon, May 2, 2011 at 11:50 AM, Josh Kamau <[email protected]> wrote:
> > This is my view;
>
> > Guice is a just a container. So all you need is to instantiate the
> > container : Injector injector = Guice.createInjector(...Modules) , Then get
> > your objects from the injector using injector.getInstance(MyClass.class);.
> > In most cases, other frameworks instantiate guice and get the objects
> > without you having to do that.
>
> > Josh.
>
> > On Mon, May 2, 2011 at 5:58 PM, mwaschkowski <[email protected]>wrote:
>
> >> Hi,
>
> >> I've searched the forum and checked the faq, but didn't see a mention
> >> anywhere. I'm assuming that guice will just wire up my objects and
> >> that application state initialization code should go somewhere else
> >> (like an 'ApplicationSetup' class) that gets called after guice is
> >> done wiring up objects? Or is there a feature within guice that I
> >> should be using to do this?
>
> >> Thanks!
>
> >> Mark
>
> >> --
> >> 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.

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