Reputation: 858
i have a strange behaviour i'm seeing that if the user access to session bean from two different browser, the istance of session bean is the same. In my opinion this is an unespected behaviour. Someone have solved the same problem? I'm using Jsf 2.0, Spring 3.0.5, Hibernate and like WebServer Glassfish. Thank you in advance.
Update
import model.entity.Utente;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
/**
*
* @author
*/
@Named
@SessionScoped
public class SessionBean implements Serializable {
this is how i declare CDI session bean
Upvotes: 0
Views: 886
Reputation: 120791
I guess the bean is managed by Spring not by CDI. (If you want to use CDI with Spring you need to do a lot of work, only using javax.inject.Named
is not enougth.)
Spring knows javax.inject.Named
but not javax.enterprise.context.SessionScoped
. To make a Spring Bean Session scoped, you need @org.springframework.context.annotation.Scope("session")
.
@see also: Spring Reference Chapter 3.5.4 Request, session, and global session scopes
Upvotes: 4