private void injectMasterChangeListeners() {
        Map<String, Object> listeners = applicationContext.getBeansWithAnnotation(MasterNodeListener.class);
        if (CollectionUtils.isNotEmpty(listeners)) {
            for (Map.Entry<String, Object> entry : listeners.entrySet()) {
                Object listener = entry.getValue();
                MasterNodeListener annotation = listener.getClass().getAnnotation(MasterNodeListener.class);
                NodeType[] nodeTypes = annotation.nodeTypes();
                boolean ok = false;
                if (nodeTypes != null && nodeTypes.length > 0) {
                    for (NodeType type : nodeTypes) {
                        if (type == nodeType()) {
                            ok = true;
                            break;
                        }
                    }
                } else {
                    ok = true;
                }
                if (!ok) {
                    continue;
                }
                if (listener instanceof MasterChangeListener) {
                    getJobNode().addMasterChangeListener((MasterChangeListener) listener);
                } else {
                    LOGGER.warn(entry.getKey() + "  is not instance of " + MasterChangeListener.class.getName());
                }
            }
        }
    }
@author Robert HG (254963746@qq.com) on 4/9/16.
lts-spring/src/main/java/com/github/ltsopensource/spring/boot/AbstractAutoConfiguration.java