-
Bug
-
Resolution: Done
-
Major
-
19.0.0.Final
-
None
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:
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
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.
- is incorporated by
-
JBEAP-19108 [GSS](7.3.z) WFLY-13297 - Weld @Resource injection does not handle expressions in the annotation attributes
- Closed
- relates to
-
WFLY-1995 Allow property substitution in EJB Annotations @ActivationConfigProperty and @ResourceAdapter with configurable option
- Closed