> That works, although I don't know if I'm fond of requiring that all > implementations be instantiated each time the ServiceFactory is > instantiated. >
If that's the only issue with that pattern, then you're in luck! You don't need to instantiate the impls when a factory is instantiated. Instead of injecting the Impl itself, inject a Provider<Impl> and return yourProviderA.get() or yourProviderB.get(). That will cause the impl to be constructed on-demand (assuming the impl is not an eager singleton). Sam -- 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=.
