title: JBoss Seam: components injected into POJOs, but not Session Beans
body: <p>I have a Seam component that handles login, with the name "authenticator":</p>
  
  <pre><code>@Name("authenticator")
  public class AuthenticatorAction implements Authenticator
  {
      @PersistenceContext 
      private EntityManager em;
  
      @In(required=false)   
      @Out(required=false, scope = SESSION)
      private User user;
  
      public boolean authenticate(){ ... }
  
  }
  </code></pre>
  
  <p>This works just fine, Seam injects the EntityManager instance. However, as soon as I add the <code>@Stateless</code> annotation, none of the injection happens! In this case, the EntityManager instance is null upon entry to the <code>authenticate()</code> method. Another interesting note is that with a separate stateful session bean I have, the Logger instance in that class is only injected if I make it static. If i have it non-static, it is not injected. Thats fine for the logger, but for stateless session beans like that, I obviously can't have static member variables for these components.</p>
  
  <p>I'm confused because this authenticator is exactly how it is in the Seam booking example: a stateless session bean with a private member variable being injected.</p>
  
  <p>Any ideas?</p>