kylixs commented on a change in pull request #9187:
URL: https://github.com/apache/dubbo/pull/9187#discussion_r791506191



##########
File path: 
dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java
##########
@@ -707,35 +708,58 @@ private T injectExtension(T instance) {
                 if (!isSetter(method)) {
                     continue;
                 }
-                /**
-                 * Check {@link DisableInject} to see if we need auto 
injection for this property
+
+                /*
+                 * Check {@link DisableInject} to see if we need autowire 
injection for this property
                  */
                 if (method.getAnnotation(DisableInject.class) != null) {
                     continue;
                 }
+
                 Class<?> pt = method.getParameterTypes()[0];
                 if (ReflectUtils.isPrimitives(pt)) {
                     continue;
                 }
 
-                try {
-                    String property = getSetterProperty(method);
-                    Object object = objectFactory.getExtension(pt, property);
-                    if (object != null) {
-                        method.invoke(instance, object);
+                /*
+                 * Check {@link Inject} to see if we need auto-injection for 
this property
+                 * {@link Inject#enable} == false will skip inject property 
phase
+                 * {@link Inject#InjectType#ByName} default inject by name
+                 */
+                String property = getSetterProperty(method);
+                Inject inject = method.getAnnotation(Inject.class);

Review comment:
       It seems strange to do injection if miss annotation, although doing so 
is compatible with the previous injection logic. Thus, the `@Inject` annotation 
is not general, comparing to `@Autowire` of Spring 
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to