0

Difference between @Named and @Qualifier annotation in CDI? When do we use what

Bhawna Joshi
  • 190
  • 2
  • 12
  • 1
    Possible duplicate of [What is javax.inject.Named annotation supposed to be used for?](http://stackoverflow.com/questions/5415261/what-is-javax-inject-named-annotation-supposed-to-be-used-for) – ytg Apr 08 '17 at 16:33

1 Answers1

3

@Named is an instance of a @Qualifier which assigns a specific name to a bean. That name has to be unique across all beans, regardless of type.

@Qualifier as a concept is a way of having multiple beans of the same type that are differentiated based on the various @Qualifier annotations they have.

John Ament
  • 11,595
  • 1
  • 36
  • 45
  • 1
    So why do we use qualifer. We can use @Named annotation to call multiple beans of the same type that are differentiated – Bhawna Joshi Apr 09 '17 at 17:06