You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/18 02:21:39 UTC

[GitHub] beiwei30 closed pull request #2505: Condition applicationContext != null is always true

beiwei30 closed pull request #2505: Condition  applicationContext != null is always true
URL: https://github.com/apache/incubator-dubbo/pull/2505
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java
index 5b41b247c8..acdb9cd44e 100644
--- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java
+++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java
@@ -78,23 +78,21 @@ public static ApplicationContext getSpringContext() {
     public void setApplicationContext(ApplicationContext applicationContext) {
         this.applicationContext = applicationContext;
         SpringExtensionFactory.addApplicationContext(applicationContext);
-        if (applicationContext != null) {
-            SPRING_CONTEXT = applicationContext;
-            try {
-                Method method = applicationContext.getClass().getMethod("addApplicationListener", ApplicationListener.class); // backward compatibility to spring 2.0.1
-                method.invoke(applicationContext, this);
-                supportedApplicationListener = true;
-            } catch (Throwable t) {
-                if (applicationContext instanceof AbstractApplicationContext) {
-                    try {
-                        Method method = AbstractApplicationContext.class.getDeclaredMethod("addListener", ApplicationListener.class); // backward compatibility to spring 2.0.1
-                        if (!method.isAccessible()) {
-                            method.setAccessible(true);
-                        }
-                        method.invoke(applicationContext, this);
-                        supportedApplicationListener = true;
-                    } catch (Throwable t2) {
+        SPRING_CONTEXT = applicationContext;
+        try {
+            Method method = applicationContext.getClass().getMethod("addApplicationListener", ApplicationListener.class); // backward compatibility to spring 2.0.1
+            method.invoke(applicationContext, this);
+            supportedApplicationListener = true;
+        } catch (Throwable t) {
+            if (applicationContext instanceof AbstractApplicationContext) {
+                try {
+                    Method method = AbstractApplicationContext.class.getDeclaredMethod("addListener", ApplicationListener.class); // backward compatibility to spring 2.0.1
+                    if (!method.isAccessible()) {
+                        method.setAccessible(true);
                     }
+                    method.invoke(applicationContext, this);
+                    supportedApplicationListener = true;
+                } catch (Throwable t2) {
                 }
             }
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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