[
https://issues.redhat.com/browse/WFLY-13297?page=com.atlassian.jira.plugi...
]
Brian Stansberry updated WFLY-13297:
------------------------------------
Description:
WFLY-1995 added support for expression resolution in the values of some attributes of some
annotations, including @Resource. But this isn't applied to all handling of @Resource.
ResourceInjectionAnnotationParsingProcessor handles some cases, 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."${the.expression}"
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.
was:
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."${the.expression}"
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.
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
Priority: Major
Fix For: 20.0.0.Beta1
WFLY-1995 added support for expression resolution in the values of some attributes of
some annotations, including @Resource. But this isn't applied to all handling of
@Resource. ResourceInjectionAnnotationParsingProcessor handles some cases, 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."${the.expression}"
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)