users@jersey.java.net

Re: [Jersey] Appeal to jersey developers for better+reliable javax.inject/cdi/weld support

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 22 Apr 2010 10:43:18 +0200

Hi Morton,

Sorry to hear your CDI experience is not good.

Note that Jersey only supports CDI as specified by JAX-RS 1.1 for EE
6. Please log an issue if you want to support CDI with Weld on SE, and
any help on that area would be much appreciated.

This area is very complex so if you can send reproducible test cases
for what does not work for you on EE 6 that would help us find issues
and resolve them faster.


I too would like to see more use of the 330 annotations. If JAX-RS 1.0
had been done while 330 was there it could be very different :-) I
also want to rip out the Jersey DI internals and replace with a DI
framework so we can maintain less code. This obviously has some large
consequences in terms of re-factoring, breaking API changes and core
dependencies. I would like to use Guice because i think it is superior
to CDI but alas there are some limitations. So perhaps Weld instead.

There is a current limitation in Jersey, specified but not required by
JAX-RS 1.1, for the better integration of @Inject. Namely support for
constructor injection or the use of @Inject on setter methods etc.

Jersey does not implement this yet. Two reasons:

1) Weld 1.0 was finished was integrated into GF very late into the
release process. You would not believe the scrambling
      around we had to do just to get the current functionality to work!

2) The area of constructor injection requires much more complex
integration with CDI, potentially modifying/adapting the
      models that CDI uses to work out what are injection targets and
what can provide references. It potentially may require
      breaking changes to some of the Jersey APIs.

We plan to tackle 2) before GF 3.1 is released.

Paul.

On Apr 22, 2010, at 2:24 AM, Morten wrote:

> I am very happy about Hersey which is the best thing since sliced
> bread when it comes to webservices support for java + the support in
> this group is great too.
>
> However, the current situation regarding support for javax.inject/
> CDI/weld inside/outside webcontainers is quite painfull. Some
> combinations work, some don't and in most cases, requires quite some
> detective work and experimentation since the documentation is not so
> good.
>
> All in all, I think I have spend maybe 50% of the time working with
> jersey on integration with with javax.inject/CDI. Sometimes as
> standalone SE applications, sometimes in Glassfish 3 both with my
> own old javax.inject implementation and latest also with weld. At
> latest, I failed to get jersey to work with weld CDI SE and is not
> trying to get it to work with a non-trivial app inside glassfish V3
> and I am also getting problems there.
>
> Hence, I would very much appreciate it if jersey integration with
> javax.inject/CDI/weld and testing+documentation of the same would
> receive a higher focus (so we can be sure that all the nice new java
> standards work well together).
>
> Also, I would be very happy to see the old jersey-specific inject
> annotations go completely away in favor of the standard
> javax.inject.Inject annotation which I much prefer to use!!
>
> Thanks for reading this,
>
> Cheers,
> Morten
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>