- 
        1. Re: scope widening of no scoped beansnimo22 Sep 3, 2010 5:03 AM (in response to nimo22)And what is the difference of this @Inject @New Users u; and that @Inject Users u; when Users is still a no-scoped-bean public class User implements Serializable{ ..}
- 
        2. Re: scope widening of no scoped beansasiandub Sep 3, 2010 6:49 AM (in response to nimo22)There is nothing like a no-scoped bean, so I'm a bit confused what you mean. The distinction is between managed beans and the rest , and between normal scoped and pseudo scoped. But no-scoped has no meaning in CDI...@SessionScoped @Named public class MyBean implements Serializable{ private @Inject Users u; }As you say yourself, the user will be dependent scoped. 
 If I create/assign the instance u within MyBean without injecting it, then u will also live within a sessionscope.That's absolutely true. But then you are taking care of the dependencies, and this will make all Weld developers sad and redundant... @Inject @New Users u; This makes sense if (and only if) the User is a normal-scoped (not pseudo-scoped) bean. Compare the spec: 
 This allows the application to obtain a new instance of a bean which is not bound to the declared scope, but has had dependency injection performed.
- 
        3. Re: scope widening of no scoped beansnickarls Sep 3, 2010 7:09 AM (in response to nimo22)You can have something like @SessionScoped public class LoginBean { @Produces @Named User user = ... }which makes sessionscoped snapshots with a dependent scoped producer. Of course, you'll have to be careful with scope lifecycle-lengths when cross-injecting like that. So @Produces @SessionScoped @Named is safer for that, I think. 
- 
        4. Re: scope widening of no scoped beansnimo22 Sep 3, 2010 7:10 AM (in response to nimo22)With no-scoped , I mean beans which has no scope declared: (maybe compare it to java.faces.bean.NonScoped).// no-scoped=pseudo-scoped: there is no scope defined in User-Object public class User implements Serializable{ ..}@Inject @New Users u; I know, for normal-scoped beans @New makes sense. Why is it senseless for pseudo-scoped bean? Because @Inject will inject everytime a new instance from a pseudo-scoped bean. Am I right? So @New is redundant for injected pseudo-scoped beans. Am I right? 
- 
        5. Re: scope widening of no scoped beansnimo22 Sep 3, 2010 7:12 AM (in response to nimo22)
 So @Produces @SessionScoped @Named is safer for that, I think.That is indeed the way, I did it! 
 
     
    