You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/10/10 03:38:56 UTC

[dubbo-website] branch master updated: Update dubbo-spi.md (#1552)

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

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 0153fb1b799 Update dubbo-spi.md (#1552)
0153fb1b799 is described below

commit 0153fb1b799c74000903c268232851962776fa15
Author: Richard <49...@users.noreply.github.com>
AuthorDate: Mon Oct 10 11:38:52 2022 +0800

    Update dubbo-spi.md (#1552)
    
    Updating Dubbo IOC is a check that injects dependencies through the setter method.
---
 .../java-sdk/reference-manual/spi/description/dubbo-spi.md  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/content/zh/docs3-v2/java-sdk/reference-manual/spi/description/dubbo-spi.md b/content/zh/docs3-v2/java-sdk/reference-manual/spi/description/dubbo-spi.md
index e374804898b..a528e0cd0e5 100644
--- a/content/zh/docs3-v2/java-sdk/reference-manual/spi/description/dubbo-spi.md
+++ b/content/zh/docs3-v2/java-sdk/reference-manual/spi/description/dubbo-spi.md
@@ -331,6 +331,19 @@ private T injectExtension(T instance) {
             if (method.getAnnotation(DisableInject.class) != null) {
                 continue;
             }
+            
+            /**
+             * 检测是否实现了ScopeModelAware、ExtensionAccessorAware类,如果实现则不注入
+             */
+            if (method.getDeclaringClass() == ScopeModelAware.class) {
+                    continue;
+            }
+            if (instance instanceof ScopeModelAware || instance instanceof ExtensionAccessorAware) {
+                if (ignoredInjectMethodsDesc.contains(ReflectUtils.getDesc(method))) {
+                    continue;
+                }
+            }
+            
             // 基本类型不注入
             Class<?> pt = method.getParameterTypes()[0];
             if (ReflectUtils.isPrimitives(pt)) {