[jboss-user] [JBoss Seam] - Re: Injecting a narrower-scoped bean into a wider-scoped bea

pete.muir@jboss.org do-not-reply at jboss.com
Sat Oct 13 13:50:35 EDT 2007


"adamw" wrote : Let's say I have beans with following scopes:
  | * A - application
  | * S - stateless
  | * C - conversation
  | 
  | In the examples I have often seen C-beans are injected into S-beans. As I understand, this is correct wrt to concurrent requests, that is, Seam will create enough copies of S-beans so that an S-bean serves at most one request at a time (if that wasn't true, and two requests invoked a method on an S-bean at the same time, one injected value would overwrite the other...)?

A you say, you can't invoke two methods on the same SLSB at the same time, it's stateless (this is part of the EJB3 contract, not Seam, to be precise).

anonymous wrote : Creating additional beans isn't possible with A-beans however: Seam can create at most one A-bean. So I suppose injecting a C-bean into an A-bean should produce an error, or at least a warning, right?

Yes, this would be a bad thing to do (you should inject the application scoped component into the conversation scoped component).  Add a FAQ to SeamProblemsFAQ if you like?

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

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



More information about the jboss-user mailing list