Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-2175

@Resource processing should not mandate lookup or mapped-name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • depchain-1.0.0-alpha-4
    • None
    • None

    Description

      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/managedBean 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]

      Attachments

        Activity

          People

            Unassigned Unassigned
            jaikiran Jaikiran Pai (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: