I haven't done this, but can't you do something like this?

serve("/a").with(Key.get(AServlet.class, Names.named("a")),
Collections.singletonMap('PROPERTY', "a"));
serve("/b").with(Key.get(AServlet.class, Names.named("b")),
Collections.singletonMap('PROPERTY', "b"));

Just make sure you don't bind AServlet as a singleton.

-Jared

On Mon, Oct 1, 2012 at 3:11 PM, Andreas Lüdeke <[email protected]> wrote:

> Hi,
>
> i would like to know whether it is possible to register the same Servlet
> class in guice with two different configurations. The goal is to have 2
> different instances of this class at runtime.
>
> something like:
>
> serve("/a").with(AServlet.class, Collections.singletonMap('PROPERTY',
> "a"));
> serve("/b").with(AServlet.class, Collections.singletonMap('PROPERTY',
> "b"));
>
> Thx
>
> Andreas
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/5nL_SWqDAIkJ.
> 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.
>

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

Reply via email to