[jboss-user] [JBoss Seam] - Re: Proper way to instantiate seam managed component

iradix do-not-reply at jboss.com
Fri Jul 21 17:37:54 EDT 2006


anonymous wrote : You should really use Component.getInstance(), not Component.newInstance().

The problem with getInstance() is after I create the first instance subsequent calls will retrieve the same instance from whatever context it was published to.  I need seperate, unique instances of the same bean and from a quick look through the code newInstance() was the only way to accomplish that.

anonymous wrote : 
  |  Are you saying that when you do that, the Log does not get injected?

That's exactly what I'm saying, although after I changed the definition from

@Logger private Log log

To

  | private Log log = new LogImpl(ClassName.class)

It started working even though it extends an abstract class that also uses Logger injection.  In other words, the subclass seems to correctly recieve a Log instance but the superclass does not.  Maybe it's a bug in Component where a Log is only injected into the first annotation along the class heirarchy?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960037#3960037

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960037



More information about the jboss-user mailing list