This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 10f08f2 Condition applicationContext != null is always true (#2505)
10f08f2 is described below
commit 10f08f2130c5323e8a93e298102103c344a2f5be
Author: Alex <[email protected]>
AuthorDate: Tue Sep 18 10:21:37 2018 +0800
Condition applicationContext != null is always true (#2505)
---
.../apache/dubbo/config/spring/ServiceBean.java | 30 ++++++++++------------
1 file changed, 14 insertions(+), 16 deletions(-)
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 5b41b24..acdb9cd 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 class ServiceBean<T> extends ServiceConfig<T>
implements InitializingBean
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) {
}
}
}