3 Replies Latest reply on Feb 11, 2011 7:04 PM by Adrian Mitev

    java-new()-Operator and @Inject @New

    nimo stephan Master

      I have this:

      public class MyView implements Serializable{
              @Inject @New
              private Users u;

      and inject a MyView into another bean x, so MyView inherits the scope of bean x.

      Now, my question:

      If I dont inject (a new instance of the entity-bean) and use new():

      private Users u = new Users();

      and inject MyView into bean x, what happens with 'u' ? What is the lifecycle and the scope of 'u'.

      Should I totally avoid new()-Constructor and always use @Inject with combination @New instead of java-new()-Operator ???