Brian Stansberry created WFLY-13297:
---------------------------------------
Summary: Weld @Resource injection does not handle expressions in the
annotation attributes
Key: WFLY-13297
URL:
https://issues.redhat.com/browse/WFLY-13297
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, EE
Affects Versions: 19.0.0.Final
Reporter: Brian Stansberry
Assignee: Brian Stansberry
WFLY-1995 added support for expression resolution in the values of some attributes of some
annotations, including @Resource. But thus isn't applied to all handling of @Resource.
ResourceInjectionAnnotationParsingProcessor handles, which AFAICT means it's handled
for EJBs (and perhaps other EE components) but it isn't handled in a simple CDI bean.
You get a failure like this:
{code}
Caused by: javax.naming.NameNotFoundException: ${the.expression} -- service
jboss.naming.context.java."${some.defined.property}"
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
at
org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:237)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at
org.jboss.as.weld.services.bootstrap.WeldResourceInjectionServices.resolveResource(WeldResourceInjectionServices.java:236)
... 73 more
{code}
The PropertyReplacer obtained from the DeploymentUnit that is used by
ResourceInjectionAnnotationParsingProcessor is also available to the weld subsystem code
that creates WeldResourceInjectionServices so a possible fix is to pass it in and have
WeldResourceInjectionServices use it. Manual testing shows that allows an app with such a
bean to work.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)