On Wed, Jan 14, 2009 at 4:53 AM, Andrew Clegg <andrew.cl...@gmail.com>wrote:

>
> Are GuiSqlMapClientProvider and NdaSqlMapClientProvider supposed to be
> singletons? You might want to try something like toInstance() method
> described in the docs for Binder:
>
>
> http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Binder.html
>
> bind(SqlMapClient.class).annotatedWith(Gui.class).toInstance( <a
> singleton instance of GuiSqlMapClient constructed however you like> );
>
> bind(SqlMapClient.class).annotatedWith(Nda.class).toInstance( <a
> singleton instance of NdaSqlMapClient constructed however you like> );
>
> Then forget about using providers.
>
> You can build the two objects however you like, with constructors or a
> factory method or a builder, and then Guice will inject them whenever
> it sees an SqlMapClient annotated with the appropriate annotations.
>
> Or I might have completely misunderstood the problem :-)
>
>

The problem(?) is that SqlMapClient.class is an object I don't have control
of it's an iBATIS class that just needs a config file sent to it. Different
DAOs I use (just two for instance) need a different load of that
SqlMapClient class. That's waht the provider was doing was loading up the
SqlMapClient with info from a config file.

So in your example above I can't really make instances of SqlMapClient. It
looks like I have the Robot Legs problem as dicussed here in the FAQ?
http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions  I would
think what I'm doing would come up a lot, which is why I seem so stumped and
feel like I'm missing something simple.

-- 
Rick

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