I'm using:
- Netbeans 8.0.2
- Tomcat 8.0.15
- Java EE 7 Web
I'm trying a simple loging.
I have a CDI aplication scoped managed bean "Aplicacion":
@Named
@ApplicationScoped
public class Aplicacion {
...
And I have a CDI session scoped managed bean "Loging":
@Named(value = "loging")
@SessionScoped
public class Loging implements Serializable {
@Inject
private Aplicacion aplicacion;
....
I want to inject aplicacion bean in Loging in order to store in the application scope the logged user (a requirement in my app is that a logged user can view the rest of the logged users). So in my class, when a user logged in, I do something like this:
aplicacion.addLoggedUser(user);
The problem is that the variable aplicacion is null, so I thing it is not being injected!
What I'm doing wrong?
Thanks
Aucun commentaire:
Enregistrer un commentaire