jakartaee / rest

Jakarta RESTful Web Services
Other
351 stars 114 forks source link

ContextResolver(s) post-@Context injection #1206

Open jim-krueger opened 5 months ago

jim-krueger commented 5 months ago

The purpose of this issue is to discuss and ultimately document how ContextResolvers will be handled in Jakarta Rest after @Context injection is deprecated/removed. This topic has been discussed in the rest-dev mailing list and I will attempt to add at least the latest discussion here.

jim-krueger commented 5 months ago

From James Perkins:

This is where I'm wondering if I'm missing something TBH. I looked at the TCK and through the RESTEasy tests as well as read over the 3.1 specification. I don't see where you can inject a type that a ContextResolver resolves with @Context. All the examples I see inject the Providers and lookup the ContextResolver to resolve the context type. Am I missing something? I might very well be, which is why I'm asking :) FWIW I thought it would work too, but all my local testing shows the injected values to always be null.

From Santiago:

Right, I think you’re correct in your analysis, this is only done programmatically. So it boils down to having support to inject Providers. However, having a method called getContextResolver in Providers when @Context is deprecated may be a bit odd —but again backward compatibility is imperative here.

jamezp commented 5 months ago

Given a ContextResolver is not used to inject components, should we keep it and not deprecate it? While it is similar to a CDI producer, it's not exactly the same. You can actually filter reslovers based on a MedaType. It seems that might still be desirable and would not be possible with a CDI producer.