|
First of all. If you will still be using different spring libraries I would stick with spring DI. Whoever will be maintaining the application will need to read and understand the spring configuration anyway so there is not that much gain in migrating the DI framework to guice. If you have no other choice here are some entry points to read up for your problems: 2) The guice servlet extension - it shows how to create the injector and how to execute code - at startup - before/after every request: https://code.google.com/p/google-guice/wiki/Servlets https://code.google.com/p/google-guice/wiki/ServletModule 3) There are several ways you can achieve this. But all of them seem to scream "service locator pattern" (https://en.wikipedia.org/wiki/Service_locator_pattern) If possible I would try to distinguish the different the different entry points to your factory as early as possible (i.e. in a servlet filter). Once you have them distinguished you can use different implementations which have only their dependencies injected. If this is too much work you can use either injector.getInstance(...) or you can have the required Provider<...> injected into your factory. What also could be of interest (but does not solve the particular problem you describe) is assisted injection https://code.google.com/p/google-guice/wiki/AssistedInject On 05/29/2014 07:49 PM, Chetan Kinger
wrote:
-- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/d/optout. |
- Using Spring and Guice together in a web application. Chetan Kinger
- Re: Using Spring and Guice together in a web applicat... Stephan Classen
