Reputation: 1347
Is there any point of using CDI @Named without a value? Isn't it then simply equivalent of using @Qualifier and @Default together?
@Named
public class GifFileEditor implements ImageFileEditor {
Upvotes: 2
Views: 942
Reputation: 16174
If I remember right, @Named
with no value
element value, when applied to a managed bean, does three things:
@Named
qualifier with an effective value
of the simple class name.beanName
of the bean in question to the simple class name.@Default
qualifier to be removed.Now, if you apply it programmatically using, for example, BeanConfigurator#addBean
, then you are in charge of deciding which of these behaviors to implement yourself.
Upvotes: 3