[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-2175) @Resource processing should not mandate lookup or mapped-name

jaikiran pai (JIRA) jira-events at lists.jboss.org
Tue Sep 21 11:36:28 EDT 2010


@Resource processing should not mandate lookup or mapped-name
-------------------------------------------------------------

                 Key: EJBTHREE-2175
                 URL: https://jira.jboss.org/browse/EJBTHREE-2175
             Project: EJB 3.0
          Issue Type: Bug
    Affects Versions: depchain-1.0.0-alpha-4
            Reporter: jaikiran pai


As per section EE.5.18, a EJB can have an injection point with just @Resource annotation without any "lookup" or "mapped-name" attribute:

<quote>
Alternatively, the Resource annotation can be used to request the injection of a Managed Bean given either its type or its name. If a name is specified using the lookup element then the type of the resource can be any of the types that the Managed Bean class implements, including any of its interfaces. If no name is specified, the type must be the Managed Bean class itself. (Note that the name element of the Resource annotation serves an entirely different purpose than the lookup element, consistently with other uses of Resource in this specification.)

The authenticationType and shareable elements of the Resource annotation must not be specified. For example, given a ShoppingCartBean bean named "cart" defined in the same module as the client code and implementing the ShoppingCart interface, a client may use any of the following methods to obtain an instance of the bean class:

    @Resource ShoppingCartBean cart;

</quote>

Currently while processing @Resource injections in an EJB, we mandate the mapped-name (for user specific types):

Caused by: java.lang.RuntimeException: mapped-name is required for org.myapp.ejb.MyBean of deployment MyBean
	at org.jboss.injection.ResourceHandler.loadXmlResourceEnvRefs(ResourceHandler.java:247) [:1.5.2]
	at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:336) [:1.5.2]
	at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:678) [:1.5.2]



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list