2 Replies Latest reply on Jul 28, 2011 6:55 PM by kragoth

    Component.getInstance

    clout

      What's diffenet Component.getInstance from new object?
      They always get a object, right?

        • 1. Re: Component.getInstance
          vata2999

          Component.getInstance : gets Seam component that means only object with @Name annotation
          new object can be every java object

          • 2. Re: Component.getInstance
            kragoth

            More importantly is that you should never use new on a Seam component/bean. If you instantiate a Seam bean by doing


            MySeamBean x = new MySeamBean();
            



            then that instance (x) of MySeamBean is not going to be a part of the Seam context and will not be managed by Seam. This means that your @In/@Out or any other Seam related interceptors will NOT work on that instance.


            So, at the end of the day when dealing with a Seam component/bean you should use either @In or Component.getInstance, or any other Seam supported operation that creates Seam beans but, never use the new operator.