Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-2107

ResourceInjectionEnricher doesn't consult the @Resource(lookup = "...") value

XMLWordPrintable

      The ResourceInjectionEnricher supports injecting the test instance fields annotated with javax.annotation.Resource. However, looking at the ResourceInjectionEnricher.getResourceName method, it only consults the annotation's name and mappedName attributes, falling back to some default afterward. The annotation's lookup attribute isn't considered at all. This might be because the lookup attribute was only added in Java EE 6 / Java SE 7, and Arquillian still supports Java 6, but that can be solved with a little bit of reflection.

      I don't know if this omission was intentional or not, but it could have easily gone unnoticed for a long while, because if CDI is present, the CDIInjectionEnricher will inject such field. However, CDI doesn't necessarily have to be present – for example with WildFly Swarm.

            Unassigned Unassigned
            lthon@redhat.com Ladislav Thon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: