1 Reply Latest reply on Sep 19, 2008 8:06 AM by vk101

    Same component under different scopes

      Could someone please explain what would be implied by the following situation.


      There's a component with a @Scope annotation indicating one scope, such as CONVERSATION, with a @Name indicating myComponent. What would it mean if you see in another component the following instance variable:


      @In(scope=PAGE/SESSION) MyComponent myComponent
      
      // and/or 
      
      @Out(scope=PAGE/SESSION) MyComponent myComponent



      In either case of injection or outjection, the same component name is being used, either with a narrower scope (e.g. PAGE) or a wider scope (e.g. SESSION), when the component is declared with a scope in the middle (e.g. CONVERSATION).


      Do any of these cases throw an exception, or do some of the declarations take precedence over the others? I'm really not sure what would be implied by such a case - can anyone help explain? Maybe this is caused by my less-than-ideal understanding of injection/outjection concepts.


      Thanks.

        • 1. Re: Same component under different scopes

          I've been trying to play around with some code to see if I can figure this out. Different combinations of wider vs narrower scopes on the variable-level annotations (than in the @Scope class-level annotation) and injection vs outjection yield different results. I haven't been able to determine what exactly happens in this case.


          Is it okay to redeclare a component of the same name under a different scope? If so, what actually happens...?