@Reference(service = MailSessionRegistrar.class,
                    policy = ReferencePolicy.DYNAMIC,
                    cardinality = ReferenceCardinality.OPTIONAL,
                    target = "(component.name=com.ibm.ws.javamail.management.j2ee.MailSessionRegistrarImpl)")
    protected void setMailSessionRegistrar(ServiceReference<MailSessionRegistrar> ref) {
        mailSessionRegistrarRef.setReference(ref);
        registerJavaMailMBean();
    }
@ Reference ( service = MailSessionRegistrar . class , policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . OPTIONAL , target = "(component.name=com.ibm.ws.javamail.management.j2ee.MailSessionRegistrarImpl)" ) protected void setMailSessionRegistrar ( ServiceReference < MailSessionRegistrar > ref ) { mailSessionRegistrarRef . setReference ( ref ) ; registerJavaMailMBean ( ) ; }
Declarative Services method for setting mail session registrar