[
http://jira.jboss.com/jira/browse/EJBTHREE-958?page=all ]
Andrew Rubinger resolved EJBTHREE-958.
--------------------------------------
Resolution: Won't Fix
@Resource annotation's element "name" does not default
to field name.
---------------------------------------------------------------------
Key: EJBTHREE-958
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-958
Project: EJB 3.0
Issue Type: Bug
Components: EJB3 Extensions
Affects Versions: AS 4.2.0 GA
Environment: Windows XP, Java 1.5
Reporter: Jari Mustonen
Assigned To: Andrew Rubinger
Priority: Minor
Fix For: AS 5.0.0.Beta3
Original Estimate: 1 hour
Remaining Estimate: 1 hour
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() {
System.out.println("myVar: " + myVar);
}
}
--- Version 2 ---
@Stateless
@Remote
@RemoteBinding(jndiBinding="daService")
public class DaServiceBean implements DaService {
@Resource(name="myVar") private int myVar;
public void foo() {
System.out.println("myVar: " + myVar);
}
}
--- 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>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira