users@jersey.java.net

[Jersey] Re: jersey-guice based on spring-guice

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Sun, 27 Oct 2013 22:57:50 -0400

Kariem,

     I have tried very hard to add Guice support to Jersey,
unfortunately I don't think it is happening. Building an HK2-Guice
bridge is very very difficult (perhaps even impossible). I think it was
a mistake to release Jersey 2.0 without first testing Guice and Spring
support. Spring support was added a few months after the initial release
and it still suffers from some pretty serious limitations (inability to
inject beans into JAX-RS classes using XML configuration). Guice support
is still dead in the water.

     I am very frustrated by the fact that all of this worked perfectly
in Jersey 1.0. In my opinion, this is a huge step backwards for end-users.

     If anyone on this list is highly experienced with HK2 and Guice
please contact me and let's try to get this fixed.

Thanks,
Gili

On 18/10/2013 5:13 AM, Kariem Hussein wrote:
> Hi,
>
> I tried the examples from JERSEY-1957 and another example [2] with
> limited success. Especially for components that should be created by
> guice (proxies for transactions) I could not find a good solution.
>
> So I thought, I follow the implementation for Spring [3] and do the
> same for Guice. I have forked the current jersey master on github and
> added the following modules:
>
> - jersey-guice – https://github.com/kariem/jersey/tree/master/ext/guice
> - example webapp –
> https://github.com/kariem/jersey/tree/master/examples/helloworld-guice-webapp
>
> Still, I have a problem with registering providers (and probably other
> things like Features), as can be seen, when you try to use the custom
> exception mapper for IllegalArgumentException
> on helloworld-guice-webapp/guice-singleton-hello?p1=foobar.
>
> Any suggestions? I really don't know HK2, so there might be a few
> things I have done wrong.
>
> Thank you,
> Kariem
>
>
> [1] https://java.net/jira/browse/JERSEY-1950
> [2] https://github.com/piersy/jersey2-guice-example-with-test
> [3] https://java.net/jira/browse/JERSEY-1957,
> https://github.com/jersey/jersey/tree/master/ext/spring3