Status: New
Owner: ----
New issue 603 by gianmarco.gherardi:
GuiceServletContextListener.getInjector should have one param:
servletContext
http://code.google.com/p/google-guice/issues/detail?id=603
This way, configuration parameters can be passed as constructor parameter
to object. For example, this is possible in normal Java application:
public static void main(String[] args) {
String fooServerAddress = args[0];
Injector injector = Guice.createInjector(new FooModule(fooServerAddress));
FooClient client = injector.getInstance(FooClient.class);
...
}
In Servlet application this should became:
public class AppGuiceServletContextListener extends
GuiceServletContextListener {
@Override
protected Injector getInjector(ServletContext servletContext) {
String fooServerAddress =
servletContext.getInitParameter("fooServerAddress");
return Guice.createInjector(new FooModule(fooServerAddress));
}
}
Check also comments on
http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions
and thread on
http://groups.google.com/group/google-guice/browse_thread/thread/dad68e87fd94261e
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.