Hey Fred, Thanks a lot for helping me get started with Guice. I believe I've gotten my DataSource injection stuff worked out. As you suggested, I created a PrivateModule that accepted an annotation and a properties filename in the constructor. I then instantiate this PrivateModule for however many separate DB connections I need, using the Singleton scope to facilitate connection pooling in the DB itself. The connections are injected into the various DAO's using the annotation for their respective data sources. I've converted over all my DAO Unit Tests and this seems to be work very well!
After reading some more documentation and getting into the question of deployment and setup in an actual system, I have quickly encountered the "robot legs" scenario that you are describing above. If I used Guice to push as far into my code base as possible, I can see it deteriorating into a really messy web. Most of my applications are web-based running in a container. Is it smart to create a static injector instance in the application container's bootstrap (servlet listener or whatever) and then use that to instantiate the objects throughout the application's base nodes (say, in the servlet itself, or wherever) Is there a different or better approach to configuring the bindings for the application in a web context? I see a guice-servlet library in the 3.0 RC2 which looks like it uses a Servlet Listener. Wondering how that jibes with GWT? Thanks for any help! E -- 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.
