[jbosstools-dev] Ambiguous EL names

Alexey Kazakov akazakov at exadel.com
Fri Jun 24 14:01:46 EDT 2011


Hi Pete,

I'm looking at examples from 
https://github.com/pmuir/jboss-as-developer-guide/tree/master/quickstarts and 
I have a question...
There is org.jboss.as.quickstarts.login.EJBUserManager:

    /...
    @Named("userManager")
    @RequestScoped
    @Alternative
    @Stateful
    public class EJBUserManager implements UserManager {
    ...
         @Produces
         @Named
         @RequestScoped
         public List<User> getUsers() throws Exception {
             ...
         }
    ...
    }
    /


It's an alternative bean class which declare a @Named producer.

And there is also another bean 
org.jboss.as.quickstarts.login.ManagedBeanUserManager:

    /@Named("userManager")
    @RequestScoped
    public class ManagedBeanUserManager implements UserManager {

         @SuppressWarnings("unchecked")
         @Produces
         @Named
         @RequestScoped
         public List<User> getUsers() throws Exception {
             ...
         }
    ...
    }
    /


So EL names of both bean classes ("userManager") are the same. This is 
OK and JBoss Tools doesn't treat it as a problem because EJBUserManager 
is an alternative.
But EL names of the producers are treated as ambiguous EL names ("users").
I looked at the spec. and still don't understand where our tooling is wrong:

/5.3.1. Ambiguous EL names
An ambiguous EL name exists in an EL expression when an EL name resolves 
to multiple beans. When an ambiguous EL
name exists, the container attempts to resolve the ambiguity. If any of 
the beans are alternatives, the container eliminates
all beans that are not alternatives, *except for producer methods and 
fields of beans that are alternatives*. If there is exactly
one bean remaining, the container will select this bean, and the 
ambiguous EL name is called resolvable./

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20110624/c8b1d753/attachment.html 


More information about the jbosstools-dev mailing list