Skip to content

[RESTEASY-3754] & [RESTEASY-3755] Update CDI support - #4937

Merged
jamezp merged 2 commits into
resteasy:6.2from
jamezp:cdi-param-qualifiers-6.2
Jul 27, 2026
Merged

jamezp merged 2 commits into
resteasy:6.2from
jamezp:cdi-param-qualifiers-6.2

Conversation

@jamezp

@jamezp jamezp commented Jul 26, 2026

Copy link
Copy Markdown
Member

Upstream: #4933

RESTEASY-3755

Enable injection of @*Param annotated parameters with CDI. Ensure invalid CDI resource beans are ignored by the CDI extension and processed by RESTEasy.

CDI Integration Changes

A new CDI extension, ResteasyParamCdiExtension, registers Jakarta REST parameter annotations (@CookieParam, @FormParam, @HeaderParam, @MatrixParam, @PathParam, @QueryParam, and @BeanParam) as CDI qualifiers. This allows Jakarta REST resources to receive parameter values via CDI injection — including constructor injection — without requiring a public no-arg constructor (provided
the class is still proxyable).

For any proxyable Jakarta REST resource or provider:

  • @Inject is implicitly added to @Context-annotated fields, setter methods, and constructors (ResteasyCdiExtension)
  • @Inject is implicitly added to @*Param-annotated fields, setter methods, and constructors (ResteasyParamCdiExtension)
  • Synthetic CDI beans are registered to produce parameter values at request time by delegating to ParameterExtractors

Resources that are not proxyable (final class, final methods, or no non-private no-arg constructor) are excluded from CDI management and handled by RESTEasy directly. This resolves the deployment regression in RESTEASY-3752 where resources with only a parameterized constructor would fail.

Other Changes

  • StringParameterConverter — new extraction/conversion system used by the CDI synthetic producers
  • CdiProxyUnwrapper — utility for unwrapping Weld and OpenWebBeans client proxies via reflective method handles
  • PropertyInjectorImpl — skips @Inject-annotated members to avoid double injection when CDI is managing the bean

RESTEASY-3754

This fixes a bug in the PriorityServiceLoader which did not include all services if the services had the same priority.

@jamezp
jamezp requested a review from a team as a code owner July 26, 2026 22:41
… CDI. Ensure invalid CDI resource beans are ignored by the CDI extension and processed by RESTEasy.

https://redhat.atlassian.net/browse/RESTEASY-3755
Signed-off-by: James R. Perkins <[email protected]>
@jamezp
jamezp force-pushed the cdi-param-qualifiers-6.2 branch from 4056b17 to f086afa Compare July 27, 2026 19:20
@jamezp
jamezp merged commit a15b6d7 into resteasy:6.2 Jul 27, 2026
12 of 17 checks passed
@jamezp
jamezp deleted the cdi-param-qualifiers-6.2 branch July 27, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant