Resteasy 3.0 (JBoss's JAX-RS implementation) is coming out soon. I just wanted to let people know that I and a few others have been giving its Guice integration some much-needed attention and new features for the first time in years.
Some of the interesting new features:
- Guice 3.0 (believe it or not)
- Handle Injector creation yourself
- @PostContruct and @PreDestroy handlers for modules
- @RequestScoped
So if you're not using CDI with JAX-RS, Guice is a pretty viable option.
Documentation: http://www.jboss.org/resteasy/docs
Source: https://github.com/Resteasy/resteasy/tree/master/jaxrs/resteasy-guice
Mwanji
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
The first link was to the official doc, which contains a Guice chapter. Sorry, didn't think to link to it directly.
http://docs.jboss.org/resteasy/docs/3.0-beta-6/userguide/html_single/index.html#Guice1
Mwanji
> Do I have to declare my modules in web.xml?
>
That's no longer the only choice. In beta-6, you can override the ServletContextListener's getModules() method and do it yourself. In rc-1 (currently only on github) you can also override withInjector(Injector) to interact with it after its creation.
I added the latter to be able to start Guice-Persist's PersistService.
Mwanji
You don't by any chance know what state there is for OSGi integration for Resteasy/Guice 3 do you?
Currently reevaluating our usage of Restlet...
Mark
Sent from an Android...
--
OSGwhat? ;)
> I can't find withInjector on github.
You're right. I got a bit ahead of myself: it's in a pull request of mine that hasn't been merged yet. Sorry.
>I could override getModules() but not getStage().
You can still set Stage in the web.xml.
>But even so, I still have do add jersey specific things to web.xml. With jersey-guice is as simple as serve("/rest/*").with(GuiceContainer.class);
With Jersey, you don't put *anything* in the web.xml? Even in a non-JEE context?
To be honest, I'm not using Jersey because, like 99% of the java.net projects that I try out, either I can't figure out from the docs how it works or the site is down.
Mwanji
--
On Jun 5, 2013 11:00 PM, "Filipe Sousa" <nat...@gmail.com> wrote:
>
> The only thing needed is the GuiceFilter and a listener. Take a look at this random project in github
> https://github.com/robinboehm/guice-jersey
That's quite nice.
Thanks for pointing out the Stage configuration. I'll see if that can be made overrideable.
With that, Resteasy-Guice config should be similar: add the Resteasy filter and a Listener.
Mwanji
Instead of a few lines in web.xml, they have a bunch of code copied from Resteasy internals. I don't think that's an improvement.
Why is it so important to not have any web framework config in web.xml, but it's OK to have DI config in there?
Mwanji
--
Am I missing something or each and every resource or provider has to be explicitly bound in the Guice Module?
Couldn't it intercept each and every resource or provider creation instead? (looks like what the CDI integration is doing, and what Ross Judson is describing below)