Is it okay to use more than one ServletModule?

27 views
Skip to first unread message

Lóránt Pintér

unread,
Jun 15, 2011, 3:18:54 PM6/15/11
to google...@googlegroups.com
Hi,

Can I do something like this? And/or is there a better way to allow more than one module to contribute servlets?

Guice.createInjector(

new ServletModule() {

@Override

public void configureServlets() {

bind(SomeService.class).to(SomeServiceImpl.class);

serve("/module1").with(Module1Servlet.class);

}

},

new ServletModule() {

@Override

public void configureServlets() {

bind(SomeOtherService.class).to(SomeOtherServiceImpl.class);

serve("/module2").with(Module2Servlet.class);

}

});


Thanks,
Lorant

Filipe Sousa

unread,
Sep 30, 2011, 9:26:41 AM9/30/11
to google...@googlegroups.com
I'm facing the same scenario. 
I would like to get an answer on this.

Thanks.

Fred Faber

unread,
Sep 30, 2011, 9:28:28 AM9/30/11
to google...@googlegroups.com
Yes, that is a supported and common pattern.

Fred

--
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/-/uPhN9tpEt-gJ.

To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Filipe Sousa

unread,
Sep 30, 2011, 9:52:02 AM9/30/11
to google...@googlegroups.com, ffa...@faiser.com
Thank you.
Reply all
Reply to author
Forward
0 new messages