-
Bug
-
Resolution: Won't Do
-
Minor
-
AS 4.2.0 GA
-
None
-
Workaround Exists
-
-
Low
The javadoc of @Resource#name states that "The JNDI name of the resource. For field annotations, the default is the field name. ..."
The following version 1 of DaServiceBean don't work as it doesn't inject anything to "myVar". The version 2 injects the value 5 correctly.
— Version 1 —
@Stateless
@Remote
@RemoteBinding(jndiBinding="daService")
public class DaServiceBean implements DaService {
@Resource private int myVar;
public void foo()
}
— Version 2 —
@Stateless
@Remote
@RemoteBinding(jndiBinding="daService")
public class DaServiceBean implements DaService {
@Resource(name="myVar") private int myVar;
public void foo()
}
— ejb-jar.xml —
<enterprise-beans>
<session>
<ejb-name>DaServiceBean</ejb-name>
<env-entry>
<env-entry-name>myVar</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>5</env-entry-value>
</env-entry>
</session>
</enterprise-beans>