[jboss-user] [JBoss Seam] - Does @Role work at instanciation or retrieving a component?

fhh do-not-reply at jboss.com
Wed Sep 27 21:12:10 EDT 2006


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

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

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



More information about the jboss-user mailing list