0 Replies Latest reply on Sep 27, 2006 9:12 PM by fhh

    Does @Role work at instanciation or retrieving a component?

    fhh Expert

      I'm not sure if I understand the @Role-Annotation correctly. Can it be used so that one component can be instanciated under two names or retrieved under two names. Imagine I have a component like this:

      @Name("foo")
      @Scope(ScopeType.SESSION)
      @Role(name="bar", scope=ScopeType.CONVERSATION)
      public class Foo {
      
      }
      


      Now I instanciate it in a jsf with the name foo by binding an input to it:
      <h:input value="#{foo.test}" />
      


      Than I inject this very instance into a SLSB like this?

      @Stateless
      public class FooBarAction {
      
       @In
       Foo foo;
      
       @In
       Foo bar;
      
       public boolean isIdentical() {
      
       return foo == bar;
       }
      
      }
      


      So the question is: Would the isIdentical()-Method return true or would it fail because bar is null? While testing it seemed to me that bar is null because the injection does not work. Is this the intended behaviour?

      If it is maybe this should be clarified in the documentation.

      Regards

      fhh

      Regards fhh