Giriş
Açıklaması şöyle
It is a special qualifier with a String value attribute. When used at an injection point, only beans with a matching @Named qualifier are considered:
Örnek
Şöyle yaparız
@Named("feline")class Cat implements Pet { }@Inject@Named("feline")Pet felinePet;
Örnek
Açıklaması şöyle
@Named is special in that it does not replace the implicit @Default qualifier. Hence, the following definition-injection pair is a match (given that there is no other Pet candidate):
Şöyle yaparız
// bean definition with @Named,// retains the implicit @Default qualifier: @Named("feline") class Cat implements Pet { } // injection point with implicit @Default qualifier: @Inject Pet felinePet;
Hiç yorum yok:
Yorum Gönder