浅谈dubbo spi机制
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 例如: private static final Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); 首先分析getExtensionLoader方法:很简单先查询EXTENSION_LOADERS是否存在不存在就new一个返回 public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) { throw new IllegalArgumentException("Extension type == null"); } if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("Extension type(" + type + ") is