title: How to specify the EJB bean name in the JNDI tree in JEE7
body: <p>I'm not sure if this is a generic JEE6 question or if it is a Wildfly 10/JBoss7 EAP implementation specific question.</p>
  
  <p>I'm trying to specify/override the default beanName used in my EJB JNDI mapping to something more meaningful to me.</p>
  
  <p>For example:</p>
  
  <p>LoginManagerBean:</p>
  
  <pre><code>@Stateless
  public class LoginManagerBean extends BaseManagerBean implements LoginManager {
  ....
  }
  </code></pre>
  
  <p>LoginManager:</p>
  
  <pre><code>@Local
  public interface LoginManager{
  ....
  }
  </code></pre>
  
  <p>In this context, WF10 will automatically create a JNDI mapping for this EJB as:</p>
  
  <pre><code>ejb:myApp/myJar/LoginManagerBean!LoginManager
  </code></pre>
  
  <p>In the Wildfly 10 documentation for <a href="https://docs.jboss.org/author/display/WFLY10/EJB+invocations+from+a+remote+client+using+JNDI" rel="nofollow noreferrer">EJB naming conventions</a>, it says
  For stateless beans:</p>
  
  <blockquote>
  <pre><code>ejb:&lt;app-name&gt;/&lt;module-name&gt;/&lt;distinct-name&gt;/&lt;bean-name&gt;!&lt;fully-qualified-classname-of-the-remote-interface&gt;
  </code></pre>
    
    <p>.... ....</p>
    
    <p>bean-name : This is the name of the bean for which you are doing the
    lookup. The bean name is typically the unqualified classname of the
    bean implementation class, but can be overriden through either
    ejb-jar.xml or via annotations. The bean name part cannot be an empty
    string in the JNDI name.</p>
  </blockquote>
  
  <p>However, I cannot seem to find which annotation to use to specify the bean name in an annotation.  If I read the docs for <a href="http://docs.oracle.com/javaee/6/api/javax/ejb/EJB.html" rel="nofollow noreferrer">@EJB</a> it states that the <code>beanName</code> parameter is:</p>
  
  <blockquote>
    <p>The ejb-name of the Enterprise Java Bean to which this reference is mapped</p>
  </blockquote>
  
  <p>So from the docs, it does not seem that the beanName is the right parameter to use.</p>
  
  <p>So how can I rename my EJB beanName in the mapping to something of my choice?  For instance, what annotation can I use to make the mapping read:</p>
  
  <pre><code>ejb:myApp/myJar/MyReallyCoolName!LoginManager
  </code></pre>