Annotation Type Primary


  • @Target({TYPE,METHOD})
    @Retention(RUNTIME)
    public @interface Primary
    Identify a bean as being the preferred bean to inject when multiple beans implement the intended interface.
    
    
     @Primary
     @Singleton
     class PreferredEmailSender implements EmailSender {
    
       ...
     }