I have this:
@SessionScoped @Named
public class MyBean implements Serializable{
@Inject @RequestScoped Users u;
} The object Users is no-scoped:
public class Users implements Serializable{
} I have the following questions:
You see, I defined the instance u as requestscoped, but it does not work. why?
If I define Users as sessionscoped:
@SessionScoped
public class Users implements Serializable{
} would this
@SessionScoped @Named
public class MyBean implements Serializable{
@Inject @New @RequestScoped Users u;
} overwrite the scope of (the new) instance of u?
Don't @Inject @FooScoped, it has no effect. The only thing that matters is the scope as defined on the bean being injected.