[arquillian-issues] [JBoss JIRA] (ARQ-2107) ResourceInjectionEnricher doesn't consult the @Resource(lookup = "...") value

Ladislav Thon (JIRA) issues at jboss.org
Fri Apr 28 07:03:01 EDT 2017


Ladislav Thon created ARQ-2107:
----------------------------------

             Summary: ResourceInjectionEnricher doesn't consult the @Resource(lookup = "...") value
                 Key: ARQ-2107
                 URL: https://issues.jboss.org/browse/ARQ-2107
             Project: Arquillian
          Issue Type: Bug
          Components: Runtime Enricher SPI
            Reporter: Ladislav Thon


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.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the arquillian-issues mailing list