You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "AlbumenJ (via GitHub)" <gi...@apache.org> on 2023/08/03 13:53:17 UTC

[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12834: Optimize code in DubboSpringInitializer

AlbumenJ commented on code in PR #12834:
URL: https://github.com/apache/dubbo/pull/12834#discussion_r1283240628


##########
dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboSpringInitializer.java:
##########
@@ -68,14 +68,15 @@ public static boolean remove(BeanDefinitionRegistry registry) {
     }
 
     public static boolean remove(ApplicationContext springContext) {
+        AutowireCapableBeanFactory autowireCapableBeanFactory = springContext.getAutowireCapableBeanFactory();
         for (Map.Entry<BeanDefinitionRegistry, DubboSpringInitContext> entry : contextMap.entrySet()) {
             DubboSpringInitContext initContext = entry.getValue();
             if (initContext.getApplicationContext() == springContext ||
-                initContext.getBeanFactory() == springContext.getAutowireCapableBeanFactory() ||
-                initContext.getRegistry() == springContext.getAutowireCapableBeanFactory()
+                initContext.getBeanFactory() == autowireCapableBeanFactory ||
+                initContext.getRegistry() == autowireCapableBeanFactory
             ) {
                 DubboSpringInitContext context = contextMap.remove(entry.getKey());
-                logger.info("Unbind " + safeGetModelDesc(context.getModuleModel()) + " from spring container: " +
+                logger.info("Unbind " + context.getModuleModel().getDesc() + " from spring container: " +

Review Comment:
   Is it possible throws NPE here?



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org