Re: CDI integration


Guillermo González de Agüero
 

Hi,

I agree @Context annotation must still work, at least from the time being. But I see two things here:
- It's easy to handle injection of @Context via CDI with just a custom extension. The spec can force implementations to use CDI for injection of @Context annotated properties only on Java EE application servers. That would still allow non Java EE users to use JAX-RS while making EE more consistent.
- @Inject doesn't equal CDI, but JSR 330, and from what I've seen, Spring already supports it. Deprecating @Context in favor or the standard annotations would still not break Spring Boot users IMO (I haven't used Spring myself so I'm maybe wrong here).


Regards,

Guillermo González de Agüero

Guillermo González de Agüero

On Wed, May 31, 2017 at 1:00 PM, Sergey Beryozkin <sberyozkin@...> wrote:
Let me step back.
+1 to having a better CDI integration, and in CXF my colleagues work hard on making it better.
@Context needs to be continued to be supported though. JAX-RS is big in EE but it needs to be present in SpringBoot, etc.
Wiring CDI into non EE can become problematic thus continuing to have a basic @Context support is good.

Sorry for hajacking the thread

Cheers, Sergey


On 31/05/17 11:53, Sergey Beryozkin wrote:
Hi

Lest not dramatize it,
difficult, confusing, all because of @Context ? I'm not going to comment.

As well as re this 'ownership' claim of JAX-RS by EE.

Sergey
On 31/05/17 11:44, Arjan Tijms wrote:
Hi,

On Wed, May 31, 2017 at 11:52 AM, Sergey Beryozkin <sberyozkin@...> wrote:
@Context is that little thing that has helped to make JAX-RS visible outside of the EE world, as opposed to it be yet another EE spec.

It's not just another EE spec, but one of the fundamental EE specs.

 
Rather than trying to keep JAX-RS more and more dependent on EE pieces I'd like to encourage us keeping it as open as possible

IMHO; open as possible also means that you eventually commit to nothing and only make it more difficult and confusing to use in its primary environment. 

Kind regards.
Arjan Tijms



 
Sergey


On 31/05/17 10:44, Sebastian Daschner wrote:

Yes, agreed.

Especially the ability to @Inject JAX-RS managed objects (basically what is @Context today) would be very helpful. That enables to inject UriInfo within the EE application and also getting rid of @Context to streamline Java EE further :-)

Cheers,
Sebastian
   


On 05/31/2017 03:12 PM, Christian Kaltepoth wrote:
I agree with Guillermo and Arjan that further CDI alignment is very important for JAX-RS. 

It would be great to see some EG discussion about this.

Christian

2017-05-25 20:13 GMT+02:00 Arjan Tijms <arjan.tijms@...>:
Hi,

I too would greatly love to see this happening. CDI alignment IMHO should have been -the- major theme of Java EE and unfortunately too few steps have been made towards that goal.

Kind regards,
Arjan Tijms



On Thu, May 25, 2017 at 8:04 PM, Guillermo González de Agüero <z06.guillermo@...> wrote:
Hi,

Time is quickly running out, and I guess what the plans are regarding CDI alignment. There's an open issue [1] labeled as "2.1-candidate" but it seems no work has been done on that yet.

Given the time and resource limits the EG has, I propose to simply add a note to the spec saying that "when running on a Java EE Application Server/when CDI is available, resources and providers MUST be available for CDI extensions to process it, just like if had a CDI bean defining annotation", e.g.: providers and resources are discovered by the CDI runtime like any other bean, but *they don't need to be treated as beans*. That basically ressembled the behaviour offered by trimmed archives on CDI 2.0 [2].

What we gain with that? Users could easily create an extension to make all the resources @RequestScoped, while maintaining the spec clean (further integration would need more discussion). At the moment it's not possible to do that with CDI [3] and you have to mark all your classes as @Dependent (a practice that is not so uncommon [4]) or mark CDI bean discovery "all"/"trimmed".

How do you see it? Do you think it's viable at this time?




--






Join jaxrs-spec@javaee.groups.io to automatically receive all group messages.