Skip to content

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

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

jamezp merged 2 commits into
resteasy:mainfrom
jamezp:cdi-param-qualifiers

Conversation

@jamezp

@jamezp jamezp commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

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 22, 2026 17:07
@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from 98c2bd3 to a8ecb7e Compare July 22, 2026 17:48
@jamezp
jamezp marked this pull request as draft July 22, 2026 20:30
@jamezp

jamezp commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

We need to decide if we should create a 7.1 version this goes into or if we're okay with this going into 7.0.3. It's kind of a big change, but should be backwards compatible for the most part. However, I'm seeing issues in WildFly where modules within WildFly need an explicit dependency on org.jboss.resteasy.resteasy-cdi so the ContextProducers is visible to them.

What I want to avoid is supporting a long term 7.0 if we do a 7.1, but that might be the way we need to go. This CDI integration will really help user to be able to start migrating to using CDI now rather than having to wait for Jakarta REST 5.0.

@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from a8ecb7e to df5d821 Compare July 23, 2026 22:12
@jamezp
jamezp marked this pull request as ready for review July 23, 2026 22:13
@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from df5d821 to a392396 Compare July 24, 2026 00:01
@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from a392396 to 55d44ef Compare July 26, 2026 22:40
@jamezp jamezp changed the title [RESTEASY-3754] & [RESTEASY-3752] Update CDI support [RESTEASY-3754] & [RESTEASY-3755] Update CDI support Jul 26, 2026
@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from 55d44ef to 28dbfb0 Compare July 26, 2026 22:43
@jamezp

jamezp commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

I've decided to keep this in 7.0 with the ability to disable it. The default is what we're referring to as enhanced CDI is enabled by default. This will be back-ported to 6.2 as well, but for 6.2 we will disable it by default.

@jamezp
jamezp force-pushed the cdi-param-qualifiers branch from 28dbfb0 to 95f2c8d Compare July 27, 2026 16:09
… 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 branch from 95f2c8d to 6590a24 Compare July 27, 2026 19:18
@jamezp
jamezp merged commit 4079afe into resteasy:main Jul 27, 2026
21 checks passed
@jamezp
jamezp deleted the cdi-param-qualifiers 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