Jakarta - EE 10 - @Inject should work instead of the deprecated @Context in RESTEasy Classic
See original GitHub issueDescribe the bug
In JAX-RS we used to use @Context
to inject several managed objects, including UriInfo
:
import jakarta.ws.rs.core.Context;
@Path("/hello")
public class GreetingResource {
@Context
UriInfo uriInfo;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
System.out.println("Base URI: " + uriInfo.getBaseUri());
return "Hello RESTEasy";
}
}
With Jakarta EE 10 and JAX-RS 4 we can use @Inject
instead:
@Inject
UriInfo uriInfo;
ATM, this code breaks with RESTEasy Classic (it works with RESTEasy Reactive) with the following exception:
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type jakarta.ws.rs.core.UriInfo and qualifiers [@Default]
- java member: org.acme.GreetingResource#uriInfo
- declared on CLASS bean [types=[org.acme.GreetingResource, java.lang.Object], qualifiers=[@Default, @Any], target=org.acme.GreeetingResource]
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
See https://jakarta.ee/specifications/restful-ws/4.0 Relates to: https://github.com/jakartaee/rest/issues/951
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a
or ver
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
or gradlew --version
)
No response
Additional information
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Jakarta - Add RESTEasy CDI to RESTEasy Common ... - GitHub
Successfully merging this pull request may close these issues. Jakarta - EE 10 - @Inject should work instead of the deprecated @Context in ......
Read more >RESTEasy - Red Hat on GitHub - JBoss.org
A Jakarta XML Binding Provider is selected by RESTEasy when a parameter or return type is an object that is annotated with Jakarta...
Read more >Chapter 5. Application Migration Changes
The Java API for XML-based RPC (JAX-RPC) was deprecated in Java EE 6 and was optional in Java EE 7. It is no...
Read more >Does RESTEasy Reactive work with Javax/Jakarta EE ...
I was looking at the RESTEasy classic to Reactive migration guide and it discuss migrating annotations from org.jboss.resteasy.annotations ...
Read more >Showing posts for tag "jakartaee" - frostillic.us
In the XPages Jakarta EE project, we use RESTEasy, whose classes are all in the org.jboss.resteasy package space. There's a (usually) hard wall...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We should definitely add
resteasy-cdi
. I will take care of it.Correct, if I have the following 2 dependencies, it works. Will it stay like that or will depending just on
quarkus-resteasy
be enough in future releases?