Hi,
with this approach i still need to Implement AServlet twice (e.g.
AServletImpl, BServletImpl extends AServlet) and need to annotate it with
@Named('a') and @Named('b').
This is exactly what i would like to avoid.
On Tuesday, October 2, 2012 6:50:26 AM UTC+2, Jared Bunting wrote:
>
> 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]<javascript:>
> > 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]<javascript:>
>> .
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>.
>> 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 view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/rw81HchFWYsJ.
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.