You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/01/30 11:28:45 UTC

[dubbo-spi-extensions] 33/39: 升级版本号,修复 #9, 增加使用SPI扫描的测试

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 2.7.x
in repository https://gitbox.apache.org/repos/asf/dubbo-spi-extensions.git

commit 971ffafd699337f6a8e1e343e2a33680d0b15668
Author: qq213539 <21...@qq.com>
AuthorDate: Thu Jan 28 13:54:26 2021 +0800

    升级版本号,修复 #9, 增加使用SPI扫描的测试
---
 .../core/DubboApiDocsAnnotationScanner.java        | 50 +++++++++++++++++---
 .../apache/dubbo/apidocs/utils/ClassTypeUtil.java  | 19 +++++++-
 .../apidocs/examples/api/IQuickStartDemo.java      | 14 +++++-
 .../examples/params/QuickStartRequestBase.java     | 53 ++++++++++++++++++++++
 .../examples-provider/pom.xml                      |  5 --
 .../apidocs/examples/api/impl/AsyncDemoImpl.java   |  4 +-
 .../examples/api/impl/QuickStartDemoImpl.java      | 20 +++++---
 .../apidocs/examples/api/impl/SyncDemoImpl.java    |  4 +-
 .../examples/spi/DubboDocExporterListener.java     | 24 ++++++++++
 .../examples/spi/TestConfigInitializer.java        | 20 ++++++++
 .../examples/spi/TestConfigPostProcessor.java      | 24 ++++++++++
 .../org.apache.dubbo.config.ConfigInitializer      |  1 +
 .../org.apache.dubbo.config.ConfigPostProcessor    |  1 +
 .../dubbo/org.apache.dubbo.rpc.ExporterListener    |  1 +
 dubbo-api-docs/pom.xml                             |  2 +-
 15 files changed, 218 insertions(+), 24 deletions(-)

diff --git a/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/core/DubboApiDocsAnnotationScanner.java b/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/core/DubboApiDocsAnnotationScanner.java
index 717bfa5..e8a8565 100644
--- a/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/core/DubboApiDocsAnnotationScanner.java
+++ b/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/core/DubboApiDocsAnnotationScanner.java
@@ -35,19 +35,24 @@ import org.apache.dubbo.apidocs.annotations.*;
 import org.apache.dubbo.apidocs.utils.ClassTypeUtil;
 
 import com.alibaba.fastjson.JSON;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.aop.support.AopUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.context.event.ApplicationReadyEvent;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.annotation.Import;
+import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Parameter;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -126,6 +131,7 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
 
     private void processApiDocAnnotation(Method method, List<ApiCacheItem> moduleApiList, ApiModule moduleAnn,
                                          boolean async, ModuleCacheItem moduleCacheItem) {
+
         ApiDoc dubboApi = method.getAnnotation(ApiDoc.class);
 
         // API basic information in API list in module
@@ -150,6 +156,7 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
         Class<?>[] argsClass = method.getParameterTypes();
         Annotation[][] argsAnns = method.getParameterAnnotations();
         Parameter[] parameters = method.getParameters();
+        Type[] parametersTypes = method.getGenericParameterTypes();
         List<ApiParamsCacheItem> paramList = new ArrayList<>(argsClass.length);
         apiParamsAndResp.setAsync(async);
         apiParamsAndResp.setApiName(method.getName());
@@ -163,6 +170,7 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
         StringBuilder methodParamInfoSb = new StringBuilder();
         for (int i = 0; i < argsClass.length; i++) {
             Class<?> argClass = argsClass[i];
+            Type parameterType = parametersTypes[i];
             methodParamInfoSb.append("[").append(i).append("]").append(argClass.getCanonicalName());
             if (i + 1 < argsClass.length) {
                 methodParamInfoSb.append(" | ");
@@ -182,7 +190,7 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
             ParamBean paramBean = this.processHtmlType(argClass, requestParam, null);
             if (paramBean == null) {
                 // Not a basic type, handling properties in method parameters
-                List<ParamBean> apiParamsList = processField(argClass);
+                List<ParamBean> apiParamsList = processField(argClass, parameterType);
                 if (apiParamsList != null && !apiParamsList.isEmpty()) {
                     paramListItem.setParamInfo(apiParamsList);
                 }
@@ -211,7 +219,20 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
      * For the attributes in the method parameters, only one layer is processed.
      * The deeper layer is directly converted to JSON, and the deeper layer is up to 5 layers
      */
-    private List<ParamBean> processField(Class<?> argClass) {
+    private List<ParamBean> processField(Class<?> argClass, Type parameterType) {
+        Map<String, String> genericTypeAndNamesMap;
+        if (parameterType instanceof ParameterizedTypeImpl) {
+            ParameterizedTypeImpl parameterTypeImpl = (ParameterizedTypeImpl) parameterType;
+            TypeVariable<? extends Class<?>>[] typeVariables = parameterTypeImpl.getRawType().getTypeParameters();
+            Type[] actualTypeArguments = parameterTypeImpl.getActualTypeArguments();
+            genericTypeAndNamesMap =  new HashMap<>(typeVariables.length);
+            for (int i = 0; i < typeVariables.length; i++) {
+                TypeVariable<? extends Class<?>> typeVariable = typeVariables[i];
+                genericTypeAndNamesMap.put(typeVariable.getTypeName(), actualTypeArguments[i].getTypeName());
+            }
+        } else {
+            genericTypeAndNamesMap =  new HashMap<>(0);
+        }
 
         List<ParamBean> apiParamsList = new ArrayList(16);
         // get all fields
@@ -219,7 +240,18 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
         for (Field field : allFields) {
             ParamBean paramBean = new ParamBean();
             paramBean.setName(field.getName());
-            paramBean.setJavaType(field.getType().getCanonicalName());
+            String genericTypeName = genericTypeAndNamesMap.get(field.getGenericType().getTypeName());
+            Class<?> genericType = null;
+            if (StringUtils.isBlank(genericTypeName)) {
+                paramBean.setJavaType(field.getType().getCanonicalName());
+            } else {
+                paramBean.setJavaType(genericTypeName);
+                try {
+                    genericType = Class.forName(genericTypeName);
+                } catch (ClassNotFoundException e) {
+                    e.printStackTrace();
+                }
+            }
             RequestParam requestParam = null;
             if (field.isAnnotationPresent(RequestParam.class)) {
                 // Handling @RequestParam annotations on properties
@@ -233,10 +265,16 @@ public class DubboApiDocsAnnotationScanner implements ApplicationListener<Applic
                 paramBean.setRequired(false);
             }
 
-            if (this.processHtmlType(field.getType(), requestParam, paramBean) == null) {
+            if (this.processHtmlType(null == genericType ? field.getType() : genericType, requestParam, paramBean) == null) {
                 // Not a basic type, handle as JSON
-                Object objResult = ClassTypeUtil.initClassTypeWithDefaultValue(
-                        field.getGenericType(), field.getType(), 0);
+                Object objResult;
+                if (null == genericType) {
+                    objResult =ClassTypeUtil.initClassTypeWithDefaultValue(
+                            field.getGenericType(), field.getType(), 0);
+                } else {
+                    objResult =ClassTypeUtil.initClassTypeWithDefaultValue(
+                            null, genericType, 0, true);
+                }
                 if (!ClassTypeUtil.isBaseType(objResult)) {
                     paramBean.setHtmlType(HtmlTypeEnum.TEXT_AREA);
                     paramBean.setSubParamsJson(JSON.toJSONString(objResult, ClassTypeUtil.FAST_JSON_FEATURES));
diff --git a/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/utils/ClassTypeUtil.java b/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/utils/ClassTypeUtil.java
index b11d534..559f288 100644
--- a/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/utils/ClassTypeUtil.java
+++ b/dubbo-api-docs/dubbo-api-docs-core/src/main/java/org/apache/dubbo/apidocs/utils/ClassTypeUtil.java
@@ -77,6 +77,20 @@ public class ClassTypeUtil {
      * @return java.lang.Object
      */
     public static Object initClassTypeWithDefaultValue(Type genericType, Class<?> classType, int processCount) {
+        return initClassTypeWithDefaultValue(genericType, classType, processCount, false);
+    }
+
+    /**
+     * Instantiate class and its fields.
+     *
+     * @param genericType  genericType
+     * @param classType    classType
+     * @param processCount processCount
+     * @param isBuildClassAttribute isBuildClassAttribute
+     * @return java.lang.Object
+     */
+    public static Object initClassTypeWithDefaultValue(Type genericType, Class<?> classType, int processCount,
+                                                       boolean isBuildClassAttribute) {
         if (processCount >= PROCESS_COUNT_MAX) {
             LOG.warn("The depth of bean has exceeded 10 layers, the deeper layer will be ignored! " +
                     "Please modify the parameter structure or check whether there is circular reference in bean!");
@@ -90,6 +104,9 @@ public class ClassTypeUtil {
         }
 
         Map<String, Object> result = new HashMap<>(16);
+        if (isBuildClassAttribute) {
+            result.put("class", classType.getCanonicalName());
+        }
         // get all fields
         List<Field> allFields = getAllFields(null, classType);
         for (Field field2 : allFields) {
@@ -280,7 +297,7 @@ public class ClassTypeUtil {
         className = className.trim();
         try {
             if (className.indexOf(GENERIC_START_SYMBOL) == -1) {
-                // CompletableFuture 中的类没有泛型
+                // classes in CompletableFuture have no generics
                 return Class.forName(className);
             } else {
                 return Class.forName(className.substring(0, className.indexOf("<")));
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/api/IQuickStartDemo.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/api/IQuickStartDemo.java
index ed99fe4..aa5251e 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/api/IQuickStartDemo.java
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/api/IQuickStartDemo.java
@@ -16,9 +16,13 @@
  */
 package org.apache.dubbo.apidocs.examples.api;
 
+import org.apache.dubbo.apidocs.examples.params.DemoParamBean4;
+import org.apache.dubbo.apidocs.examples.params.QuickStartRequestBase;
 import org.apache.dubbo.apidocs.examples.params.QuickStartRequestBean;
 import org.apache.dubbo.apidocs.examples.params.QuickStartRespBean;
 
+import java.util.List;
+
 /**
  * quick start demo.
  */
@@ -31,6 +35,14 @@ public interface IQuickStartDemo {
      * @param beanParam
      * @return org.apache.dubbo.apidocs.examples.params.QuickStartRespBean
      */
-    QuickStartRespBean quickStart(String strParam, QuickStartRequestBean beanParam);
+//    QuickStartRespBean quickStart(String strParam, QuickStartRequestBean beanParam);
+
+    /**
+     * quick start demo, request use generic.
+     * @param beanList
+     * @param beanParam
+     * @return org.apache.dubbo.apidocs.examples.params.QuickStartRespBean
+     */
+    QuickStartRespBean quickStart2(List<String> beanList, QuickStartRequestBase<QuickStartRequestBean, DemoParamBean4> beanParam);
 
 }
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/params/QuickStartRequestBase.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/params/QuickStartRequestBase.java
new file mode 100644
index 0000000..94cbd0f
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-api/src/main/java/org/apache/dubbo/apidocs/examples/params/QuickStartRequestBase.java
@@ -0,0 +1,53 @@
+package org.apache.dubbo.apidocs.examples.params;
+
+import org.apache.dubbo.apidocs.annotations.RequestParam;
+
+/**
+ * QuickStartRequestBase.
+ *
+ * @date 2021/1/26 15:24
+ */
+public class QuickStartRequestBase<E, T> {
+
+    @RequestParam(value = "Request method", required = true)
+    private String method;
+
+    private T body;
+
+    private E body3;
+
+    private QuickStartRequestBean body2;
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public T getBody() {
+        return body;
+    }
+
+    public void setBody(T body) {
+        this.body = body;
+    }
+
+    public QuickStartRequestBean getBody2() {
+        return body2;
+    }
+
+    public void setBody2(QuickStartRequestBean body2) {
+        this.body2 = body2;
+    }
+
+    public E getBody3() {
+        return body3;
+    }
+
+    public void setBody3(E body3) {
+        this.body3 = body3;
+    }
+
+}
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
index dd05f82..cc6ac7f 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
@@ -66,11 +66,6 @@
 
         <dependency>
             <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-spring-boot-starter</artifactId>
         </dependency>
 
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/AsyncDemoImpl.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/AsyncDemoImpl.java
index 9a4b4c7..7f45ef2 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/AsyncDemoImpl.java
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/AsyncDemoImpl.java
@@ -37,8 +37,8 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 /**
  * Asynchronous demo implementation.
  */
-@DubboService(async = true)
-@ApiModule(value = "Asynchronous demo", apiInterface = IAsyncDemo.class)
+//@DubboService(async = true)
+//@ApiModule(value = "Asynchronous demo", apiInterface = IAsyncDemo.class)
 public class AsyncDemoImpl implements IAsyncDemo {
 
     public static final ScheduledExecutorService EXECUTOR = new ScheduledThreadPoolExecutor(
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/QuickStartDemoImpl.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/QuickStartDemoImpl.java
index 0d9bdc7..c2c9d17 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/QuickStartDemoImpl.java
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/QuickStartDemoImpl.java
@@ -18,25 +18,33 @@ package org.apache.dubbo.apidocs.examples.api.impl;
 
 import org.apache.dubbo.apidocs.annotations.ApiDoc;
 import org.apache.dubbo.apidocs.annotations.ApiModule;
-import org.apache.dubbo.apidocs.annotations.RequestParam;
 import org.apache.dubbo.apidocs.examples.api.IQuickStartDemo;
+import org.apache.dubbo.apidocs.examples.params.DemoParamBean4;
+import org.apache.dubbo.apidocs.examples.params.QuickStartRequestBase;
 import org.apache.dubbo.apidocs.examples.params.QuickStartRequestBean;
 import org.apache.dubbo.apidocs.examples.params.QuickStartRespBean;
 import org.apache.dubbo.config.annotation.DubboService;
 
+import java.util.List;
+
 /**
  * quick start demo implement.
  *
- * @author klw(213539 @ qq.com)
  * @date 2020/12/23 17:21
  */
-@DubboService
+@DubboService(version = "v0.1")
 @ApiModule(value = "quick start demo", apiInterface = IQuickStartDemo.class, version = "v0.1")
 public class QuickStartDemoImpl implements IQuickStartDemo {
 
-    @ApiDoc(value = "quick start demo", version = "v0.1", description = "this api is a quick start demo", responseClassDescription="A quick star response bean")
+//    @ApiDoc(value = "quick start demo", version = "v0.1", description = "this api is a quick start demo", responseClassDescription="A quick star response bean")
+//    @Override
+//    public QuickStartRespBean quickStart(@RequestParam(value = "strParam", required = true) String strParam, QuickStartRequestBean beanParam) {
+//        return new QuickStartRespBean(200, "hello " + beanParam.getName() + ", " + beanParam.toString());
+//    }
+
+    @ApiDoc(value = "quick start demo, request use generic.", version = "v0.1", description = "quick start demo, request use generic.", responseClassDescription="A quick star response bean")
     @Override
-    public QuickStartRespBean quickStart(@RequestParam(value = "strParam", required = true) String strParam, QuickStartRequestBean beanParam) {
-        return new QuickStartRespBean(200, "hello " + beanParam.getName() + ", " + beanParam.toString());
+    public QuickStartRespBean quickStart2(List<String> beanList, QuickStartRequestBase<QuickStartRequestBean, DemoParamBean4> beanParam) {
+        return new QuickStartRespBean(200, "【" + beanParam.getMethod() + "】hello " + beanParam.getBody3().getName() + ", " + beanParam.toString());
     }
 }
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/SyncDemoImpl.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/SyncDemoImpl.java
index 8998566..faf4166 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/SyncDemoImpl.java
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/api/impl/SyncDemoImpl.java
@@ -37,8 +37,8 @@ import java.util.Map;
 /**
  * Synchronous demo implementation.
  */
-@DubboService
-@ApiModule(value = "Synchronous demo", apiInterface = ISyncDemo.class)
+//@DubboService
+//@ApiModule(value = "Synchronous demo", apiInterface = ISyncDemo.class)
 public class SyncDemoImpl implements ISyncDemo {
 
     private static final Logger log = LoggerFactory.getLogger(SyncDemoImpl.class);
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/DubboDocExporterListener.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/DubboDocExporterListener.java
new file mode 100644
index 0000000..bf37d55
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/DubboDocExporterListener.java
@@ -0,0 +1,24 @@
+package org.apache.dubbo.apidocs.examples.spi;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.Exporter;
+import org.apache.dubbo.rpc.ExporterListener;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * .
+ *
+ * @date 2020/10/29 10:50
+ */
+@Activate
+public class DubboDocExporterListener implements ExporterListener {
+    @Override
+    public void exported(Exporter<?> exporter) throws RpcException {
+        System.out.println("=============exported=============");
+    }
+
+    @Override
+    public void unexported(Exporter<?> exporter) {
+        System.out.println("=============unexported=============");
+    }
+}
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigInitializer.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigInitializer.java
new file mode 100644
index 0000000..e4900cd
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigInitializer.java
@@ -0,0 +1,20 @@
+package org.apache.dubbo.apidocs.examples.spi;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.config.ConfigInitializer;
+import org.apache.dubbo.config.ServiceConfig;
+
+/**
+ * .
+ *
+ * @date 2021/1/12 17:09
+ */
+@Activate
+public class TestConfigInitializer implements ConfigInitializer {
+
+    @Override
+    public void initServiceConfig(ServiceConfig serviceConfig) {
+        System.out.println("====initServiceConfig");
+    }
+
+}
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigPostProcessor.java b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigPostProcessor.java
new file mode 100644
index 0000000..d600abd
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/java/org/apache/dubbo/apidocs/examples/spi/TestConfigPostProcessor.java
@@ -0,0 +1,24 @@
+package org.apache.dubbo.apidocs.examples.spi;
+
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.config.ConfigPostProcessor;
+import org.apache.dubbo.config.ServiceConfig;
+
+/**
+ * .
+ *
+ * @date 2021/1/12 16:51
+ */
+@Activate
+public class TestConfigPostProcessor implements ConfigPostProcessor {
+
+
+    @Override
+    public void postProcessServiceConfig(ServiceConfig serviceConfig) {
+//        ((ServiceBean)serviceConfig).getService()
+//        ((ServiceBean)serviceConfig).applicationContext.getBean(((ServiceBean) serviceConfig).getInterfaceClass());
+        serviceConfig.getRef();  // 拿实例
+        System.out.println("====postProcessServiceConfig");
+    }
+
+}
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigInitializer b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigInitializer
new file mode 100644
index 0000000..9d71897
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigInitializer
@@ -0,0 +1 @@
+testConfigInitializer=org.apache.dubbo.apidocs.examples.spi.TestConfigInitializer
\ No newline at end of file
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigPostProcessor b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigPostProcessor
new file mode 100644
index 0000000..2d3fe88
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.config.ConfigPostProcessor
@@ -0,0 +1 @@
+testConfigPostProcessor=org.apache.dubbo.apidocs.examples.spi.TestConfigPostProcessor
\ No newline at end of file
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.ExporterListener b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.ExporterListener
new file mode 100644
index 0000000..154368f
--- /dev/null
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.ExporterListener
@@ -0,0 +1 @@
+dubboDoc=org.apache.dubbo.apidocs.examples.spi.DubboDocExporterListener
\ No newline at end of file
diff --git a/dubbo-api-docs/pom.xml b/dubbo-api-docs/pom.xml
index 42c634e..28c4f00 100644
--- a/dubbo-api-docs/pom.xml
+++ b/dubbo-api-docs/pom.xml
@@ -85,7 +85,7 @@
     </issueManagement>
 
     <properties>
-        <revision>2.7.8.1</revision>
+        <revision>2.7.8.2-SNAPSHOT</revision>
         <project.build.jdkVersion>1.8</project.build.jdkVersion>
         <argLine>-Dfile.encoding=UTF-8</argLine>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>