2009/1/14 Rick <ric...@gmail.com>:
> I see, use a Module class instead of a Provider? I never thought of that.
> That's where I was getting stumped - "where to do that work that initializes
> the sqlMapClient instance that I'll need."  I didn't think Modules were for
> that sort of thing, but it looks pretty clean. I'm going to try that and
> I'll post back how it works. Thanks a lot Andrew.

You might want to put most of it in a helper class in order to keep
the module clean, obviously... But apart from that I don't see why you
shouldn't.

That's what toInstance is usually used for I think, providing a
pre-made object that you've built with or without Guice's help. Bear
in mind that it means your SqlMapClient instances must be
eager-loaded, i.e. you can't delay instantiation of them til first use
like you could with a provider. I think.

If I'm encouraging bad practice somehow, somebody please shout, I
wouldn't want to mislead anyone here :-)

Andrew.

-- 
New site launched: http://biotext.org.uk/

I am retiring my old email addresses.
Please use firstn...@nervechannel.com where firstname = andrew.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-guice@googlegroups.com
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to