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
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
精彩评论