]
Bartosz Majsak updated ARQ-2107:
--------------------------------
Affects Version/s: 1.1.13.Final
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
Affects Versions: 1.1.13.Final
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.