You can use the Key from those bindings:
http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/servlet/ServletModule.ServletKeyBindingBuilder.html#with(com.google.inject.Key<?
extends HttpServlet>)
serve("/a1").with(Key.get(A.class, Names.named("a1"));
On Fri, Dec 21, 2012 at 4:01 AM, <[email protected]> wrote:
> II have two bindings in my parent module like this:
>
> bind(A.class).annotatedWith(Names.named("a1")).to(A1.class);
> bind(A.class).annotatedWith(Names.named("a2")).to(A2.class);
>
> I also have generic servlet class:
>
> class XServlet<T extends A> extends HttpServlet {...}
>
>
> In another module (ServletModule) I want to register this servlet twice
> with different type parameters, A1 & A2 respectively. Is there a way I can
> do that without specifying A1 & A2 explicitely, but rather using bindings
> mentioned above?
>
> serve("/a1").with(???)
> serve("/a2").with(???)
>
> Can this be done at all?
>
> --
> 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/-/i5UUZIv0Vg4J.
> 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.