From 92a69f136ac30601d84a986754eaffb0ad75e2e9 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Tue, 5 Mar 2019 15:34:41 +0800 Subject: [PATCH 1/2] #3476: NullPointerException happened when using SpringContainer.getContext() --- .../org/apache/dubbo/container/spring/SpringContainer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java b/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java index 32f2475a07a..4cac2c6ffe9 100644 --- a/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java +++ b/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java @@ -32,7 +32,7 @@ public class SpringContainer implements Container { public static final String SPRING_CONFIG = "dubbo.spring.config"; - public static final String DEFAULT_SPRING_CONFIG = "classpath*:META-INF/spring/*.xml"; + public static final String DEFAULT_SPRING_CONFIG = "classpath*:spring/*.xml"; private static final Logger logger = LoggerFactory.getLogger(SpringContainer.class); static ClassPathXmlApplicationContext context; @@ -46,7 +46,8 @@ public void start() { if (StringUtils.isEmpty(configPath)) { configPath = DEFAULT_SPRING_CONFIG; } - context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+")); + context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+"), false); + context.refresh(); context.start(); } From 53d87b945097871b407b71513281e120a5a33f89 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Tue, 5 Mar 2019 15:38:35 +0800 Subject: [PATCH 2/2] rollback change for DEFAULT_SPRING_CONFIG --- .../java/org/apache/dubbo/container/spring/SpringContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java b/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java index 4cac2c6ffe9..884fe098e32 100644 --- a/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java +++ b/dubbo-container/dubbo-container-spring/src/main/java/org/apache/dubbo/container/spring/SpringContainer.java @@ -32,7 +32,7 @@ public class SpringContainer implements Container { public static final String SPRING_CONFIG = "dubbo.spring.config"; - public static final String DEFAULT_SPRING_CONFIG = "classpath*:spring/*.xml"; + public static final String DEFAULT_SPRING_CONFIG = "classpath*:META-INF/spring/*.xml"; private static final Logger logger = LoggerFactory.getLogger(SpringContainer.class); static ClassPathXmlApplicationContext context;