A tonne of code at my company uses the javax.inject.Named
annotation with the default value, which the Javadoc indicates is the empty string ""
.
For example:
@Named
public class Foo {
...
}
This does not appear to add any value, since the empty string doesn't have any semantic meaning. If I remove the @Named
annotations will there be any harmful effects?
The question What is javax.inject.Named annotation supposed to be used for? describes how @Named
functions, but doesn't explain any special significance of the empty string, or why it would be necessary or beneficial to omit the actual name.
The question When should you explicitly name a Managed Bean? likewise talks about when you would want to use names to differentiate injectable beans, but doesn't provide any rationale for the use of the empty string as a name.
Can I delete these un-named @Named
annotations without breaking anything?