-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jakarta - EE 10 - @Inject should work instead of the deprecated @Context in RESTEasy Classic #29240
Comments
Are you using Asking because the latter should already support what you are asking for (I don't know about the former) |
/cc @gsmet, @manovotn, @maxandersen, @radcortez, @Sanne |
@geoand good point. I've just updated the title and body of the issue. It works with RestEasy Reactive but not RestEasy Classic |
It should work with RESTEasy 6.2 if the |
Correct, if I have the following 2 dependencies, it works. Will it stay like that or will depending just on
|
We should definitely add |
Fixes quarkusio#29240 (cherry picked from commit d8bb96d)
[It is now possible](gsmet/quarkus@2d43322) to use `@Inject` on field injection points in RESTEasy Classic providers instead of `@Context. RESTEasy Reactive has already supported this approach. [There is a plan to drop support](quarkusio/quarkus#29240) of `@Context` on method parameters too, however this is not supported by RESTEasy (classic) yet. - module HTTP advanced: - `UriInfo` is newly injected with `@Inject`, however legacy `@Context` is stll used for `HttpRequest` injection - module HTTP advanced reactive: - in `PremierLeagueContainerRequestFilter`, `UriInfo` is newly injected with `@Inject`, however legacy `@Context` is stll used for `HttpRequest` injection - in `StringResponseSerializer`, `HttpServerRequest` is newly using `@Inject` - module HTTP Rest Client Reactive: - I dropped the only `@Conext` that was there as the provider member wasn't used at all - module OpenTelemetry Reactive (uses RESTEasy Mutiny): - dropped `@Context` from resource method param as we have several tests where resources are using `@Context` and I consider it interesting that `@Context` is in fact not needed there at all (we can see similar behavior on multiple RESTEasy Reactive upstream tests, e.g. in `io.quarkus.resteasy.reactive.jsonb.deployment.test.sse.SseResource`, `io.quarkus.resteasy.reactive.jackson.deployment.test.streams.StreamResource` and plenty others (same goes for `@Context` usage, it's frequently used in upstream) - module Security - Basic - dropped `@Context SecurityContext security` from resource method parameters and instead, I used `@Inject` on setter. IMO we should test this pattern as it's legit and in this module, `@Context SecurityContext security` is used in 5 other cases (`UserResource`, `DenyAllResource`, `EveryoneResource`, `PermitAllResource` and `UnannotatedResource`). Note: `@Inject` can't be used on fields. This change is done according to the [QUARKUS-2736 test plan](https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2736.md).
Describe the bug
In JAX-RS we used to use
@Context
to inject several managed objects, includingUriInfo
:With Jakarta EE 10 and JAX-RS 4 we can use
@Inject
instead:ATM, this code breaks with RESTEasy Classic (it works with RESTEasy Reactive) with the following exception:
See https://jakarta.ee/specifications/restful-ws/4.0
Relates to: jakartaee/rest#951
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.0.0.Alpha1
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: