JBoss Seam: components injected into POJOs, but not Session Beans
Posted
by purecharger
on Stack Overflow
See other posts from Stack Overflow
or by purecharger
Published on 2010-03-08T19:59:16Z
Indexed on
2010/03/08
21:51 UTC
Read the original article
Hit count: 382
I have a Seam component that handles login, with the name "authenticator":
@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(){ ... }
}
This works just fine, Seam injects the EntityManager instance. However, as soon as I add the @Stateless
annotation, none of the injection happens! In this case, the EntityManager instance is null upon entry to the authenticate()
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.
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.
Any ideas?
© Stack Overflow or respective owner