Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19108

[GSS](7.3.z) WFLY-13297 - Weld @Resource injection does not handle expressions in the annotation attributes

XMLWordPrintable

      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:

      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.

              chaowan@redhat.com Chao Wang
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: