I am just guessing as I never tried it but wouldn't the following work 
(assuming guice-servlet)?

@RequestScoped
public final MyService provideMyService(Injector injector, 
@RequestParameters Map<String, String[]> requestParams) {
   String txValue = ... // get TX query param value from requestParams
   String className = lookupImplClass(txValue); // same lookup code as 
before which searches through your configuration
   Class<?> serviceImplClass = Class.forName(className);
   return injector.getInstance(serviceImplClass); // should work because of 
Just-In-Time bindings
}

And then you inject a Provider<MyService> into your servlet and call 
service.get() for each request? Since provideMyService() is called for each 
request it should provide the correct implementation and you can use 
@Inject in all your service implementations.

-- J.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/09ad221e-7540-4c77-86e3-234496ae5337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to