[cdi-dev] Sorting out the "bean name" mess

Pete Muir pmuir at redhat.com
Thu Sep 6 17:27:53 EDT 2012

On 6 Sep 2012, at 18:21, Bill Shannon wrote:

> Pete Muir wrote on 09/06/2012 07:04 AM:
>> All
>> https://issues.jboss.org/browse/CDI-250
>> The way a bean's name is referred to in the CDI spec is somewhat disjointed.
>> I think this occurred because the CDI spec was written with the term "bean name", but it got changed due to concerns over confusion with:
>> * JSF managed beans name
>> * @ManagedBean name
>> * EJB bean names
>> As a result, we now have a mix of "bean name", "bean EL name", and "name", which is ultimately just confusing.
>> I would like to standardize on a single term, and I would propose "bean name".
>> Thoughts?
> I agree with standardizing on a single term.
> Where can I use these names?  My understanding is that they're only or
> mostly used in EL expressions, thus "bean EL name".


> Can I inject a bean by name?  That would motivate the more general
> "bean name".

You can do

public class Foo {}

public class Bar {

   @Inject @Named Foo baz;


We strongly recommend you don't do it, but you can...

More information about the cdi-dev mailing list