problem injecting Sessionscoped bean in Managed bean
- by user310852
I have a Session scoped bean
@SessionScoped
public class UserData implements Serializable {
private String uid;
public String getUid() {
return uid;
}
public void setUid(final String uid) {
this.uid = uid;
}
I'm setting a value in a SessionScoped bean in my stateless session bean
public void setOperator(final Operator operator) {
userData.setUid(operator.getId());
}
When I try to get the object with @Inject I only get null
@ManagedBean(name = "RoleController")
@SessionScoped
public class RoleController {
...
@Inject
private UserData userData;
...
public UserData getUserData() {
System.out.println("ID");
System.out.println(userData.getUid());
I have a bean.xml