1 Reply Latest reply on Jan 7, 2012 10:39 PM by mikkus70

    Injecting and Outjecting components

    newbee07

      Guys,


      I have some basic simple questions, that I am not clear of in seam. I have been using seam for our application.


      1) Can we inject conversation scoped components into session or global scoped components.


      2) Can we outject conversation scoped components from session or global scoped components.


      3) can we inject session scoped components into global scoped components.


      4) can we outject session scoped components from global scoped components.



      If possible please guide me through some documentation.


      Regards


      Khan.

        • 1. Re: Injecting and Outjecting components
          mikkus70

          Hi,


          There are almost no limitations as to the scopes of the components involved in injection or outjection (a few special types of components, such as datamodels, can only reside in specific contexts, for example the datamodel can exist in the PAGE context only). So the answer to all your questions is YES, but keep in mind that:



          1. Injected components need to exist, unless you declare them as @AutoCreate or inject them with create=true. You can specify the scope from which you want to inject from, but it is not necessary as Seam performs a lookup of the component in all scopes.

          2. Outjected components are outjected into the same scope in which the outjecting component resides, unless you explicitly outject it into a different scope, say: @Out(scope=ScopeType.CONVERSATION).



          Seam is quite well documented, so the reference manual is your best source of information (chapter 4.3 explains bijection quite exhaustively). Also, these things are quite simple to try out, just create a test application, make the components and test these interactions. Making a few simple tests is faster than waiting for a response in these boards.