Skip to content

PathParam injection doesn't work in subresources in Quarkus REST (formerly RESTEasy Reactive) #39800

@tanadeau

Description

@tanadeau

Describe the bug

Per JAX-RS, request-scoped subresources have the ability to have parent path parameters, etc. injected. This works correctly for Quarkus RESTEasy and has for years.

We are looking at transitioning to Quarkus REST, and the transition was quite painless until we ran our tests and saw that almost all of our subresources were broken at runtime because none of the parent path parameters were injected.

See discussion in another ticket starting at #37148 (comment).

Expected behavior

@PathParam from a parent resource works and is properly injected in subresources in Quarkus REST as it is in Quarkus RESTEasy.

Actual behavior

Using Quarkus REST, @PathParam injection doesn't occur, and the fields are kept to their default value (usually null).

How to Reproduce?

Reproducer:
code-with-quarkus-bug-reproducer.zip

Steps to reproduce:

  1. Run with Quarkus REST: ./mvnw compile quarkus:dev
  2. Use curl to request subresource endpoint: curl http://localhost:8080/hello/2/sub where "2" is the parent path param
  3. Expected response is "Hello from SubResource of Hello 2". Actual response is "Hello from SubResource of Hello null"

If you change quarkus-rest to quarkus-resteasy in pom.xml and re-run the steps above, the expected response is produced.

Output of uname -a or ver

Darwin QJRQ3G49V3-ML 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64

Output of java -version

openjdk version "21.0.2" 2024-01-16 OpenJDK Runtime Environment Homebrew (build 21.0.2) OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)

Quarkus version or git rev

3.9.1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /Users/nadeata1/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 21.0.2, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "14.4.1", arch: "aarch64", family: "mac"

Additional information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions