This content has been marked as final.
Show 2 replies
-
1. Re: Component.getInstance
vata2999 Jul 28, 2011 10:41 AM (in response to clout)Component.getInstance : gets Seam component that means only object with @Name annotation
new object can be every java object -
2. Re: Component.getInstance
kragoth Jul 28, 2011 6:55 PM (in response to clout)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.