Open interphase404 opened 10 months ago
/cc @brunobat (micrometer), @ebullient (micrometer)
Not sure if I understand the problem, @interphase404 can you please add a reproducer?
I'm really sorry for not being able to describe this issue more clearly. Here is a reproducer: https://github.com/interphase404/quarkus-reproducer-38010
If you run it using:
mvn quarkus:dev
and call endpoint http://localhost:8080/annotations only this will be printed to the console:
2024-01-03 20:45:48,468 INFO [org.acm.AnnotationResource] (executor-thread-1) @jakarta.enterprise.context.ApplicationScoped()
However if you remove the dependncy quarkus-micrometer-registry-prometheus, then the console will display this:
2024-01-03 20:47:27,170 INFO [org.acm.AnnotationResource] (executor-thread-1) @jakarta.ws.rs.Path(value="/annotations") 2024-01-03 20:47:27,173 INFO [org.acm.AnnotationResource] (executor-thread-1) @jakarta.enterprise.context.ApplicationScoped()
Got it! Sounds like a bug indeed.
This only happens with RESTEasy Classic (RESTeasy Reactive is not affected).
The high level reason it happens is because the JAX-RS Resource class is scoped as @ApplicationScoped
- why this happens I do not know.
Describe the bug
If dependency
quarkus-micrometer-registry-prometheus
is present,@Path
annotation disappears from resource classes in runtime. For example it completely removes the possibility of calling methodpath(Class resource)
fromjakarta.ws.rs.core.UriBuilder
because the class is required to be annotated with@Path
and runtime doesn't have this informationExpected behavior
@Path
annotation should be present when calling getClass().getAnnotations()Actual behavior
@Path
annotation is not present when calling getClass().getAnnotations()How to Reproduce?
It is very simple to reproduce this issue.
quarkus create app --extension='resteasy-jackson'
quarkus-micrometer-registry-prometheus
hello()
methodgetClass().getAnnotations()
Output of
uname -a
orver
No response
Output of
java -version
openjdk version "11.0.20" 2023-07-18 OpenJDK Runtime Environment Temurin-11.0.20+8 (build 11.0.20+8) OpenJDK 64-Bit Server VM Temurin-11.0.20+8 (build 11.0.20+8, mixed mode)
Quarkus version or git rev
3.2.9, 3.6.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Additional information
No response