扩展点本身的加载容器,可从不同容器加载扩展点。
org.apache.dubbo.common.extension.ExtensionFactory
<dubbo:application compiler="jdk" />
org.apache.dubbo.common.extension.factory.SpiExtensionFactory
org.apache.dubbo.config.spring.extension.SpringExtensionFactory
Maven 项目结构:
src
|-main
|-java
|-com
|-xxx
|-XxxExtensionFactory.java (实现ExtensionFactory接口)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.common.extension.ExtensionFactory (纯文本文件,内容为:xxx=com.xxx.XxxExtensionFactory)
XxxExtensionFactory.java:
package com.xxx;
import org.apache.dubbo.common.extension.ExtensionFactory;
public class XxxExtensionFactory implements ExtensionFactory {
public Object getExtension(Class<?> type, String name) {
// ...
}
}
META-INF/dubbo/org.apache.dubbo.common.extension.ExtensionFactory:
xxx=com.xxx.XxxExtensionFactory