--
You received this message because you are subscribed to the Google Groups "google-guice" group.
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.
Eelco
Here is the an example of code that I use to setup JAXRS/ Jersey with
Guice, but you have to read through the fluff a bit since we built a
mini framework around Guice.
Settings settings = new Settings();
settings.setSetting("com.sun.jersey.config.property.packages",
ErrorTrapTest.class.getPackage().getName());
Dependencies dependencies = new Dependencies(settings,
new ServletModule(), new LocalServiceRegistryModule(),
testModule, new SchedulerModule(settings),
new ErrorTrapModule());
ServletAdapter adapter = new ServletAdapter();
JerseyGuiceContainer container = dependencies
.getInstance(JerseyGuiceContainer.class);
adapter.setServletInstance(container);
GuiceFilter filter = new GuiceFilter();
adapter.addFilter(filter, "guiceFilter", null);
SelectorThread threadSelector = GrizzlyServerFactory.create(
"http://localhost:9998/", adapter);
In the code above, Settings is a boosted properties loader and
Dependencies a wrapper around Injector (which is created in the
constructor) that amongst other things binds settings to Names
(Names.bindProperties(binder(), settings.getProperties());).
JerseyGuiceContainer is a slightly tweaked version of GuiceContainer
(https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/GuiceContainer.html).
Hope that helps,
Eelco
--
Ah yes, I've seen that before. For some funny reason, Jersey refuses
to start up if it doesn't find anything to work with in the packages
you give it to scan. If you add a service, you should be good. At
least for that error :-)
Eelco
Not sure what's wrong, but you may be best of trying to follow the
documentation you can find here:
https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/index.html
Eelco
Eelco
Thanks i'll digg into it. And come back with the result..
Yeah, mine do get picked up automatically. I guess the debugger is
your friend. I also vaguely remember that either servlets or jaxrs
resources need to be annotated with @Singleton. Not sure if it would
help, but you could give that a spin.
Eelco
Eelco