[Dubbo-1684] add unit test for dubbo spring config (#1809)

* add test for config spring module

* add more test for serviceBean and refBean
diff --git a/.codecov.yml b/.codecov.yml
index bd786c1..3d04ce5 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -6,4 +6,5 @@
         threshold: 0.1%
 ignore:
   - "dubbo-demo/.*"
-  - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #  internal JSON impl is deprecate, ignore test coverage for them
\ No newline at end of file
+  - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #  internal JSON impl is deprecate, ignore test coverage for them
+  - "dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java" # Deprecated
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
index 80de429..86c37be 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
@@ -46,7 +46,7 @@
 import com.alibaba.dubbo.rpc.RpcException;

 import com.alibaba.dubbo.rpc.service.GenericException;

 import com.alibaba.dubbo.rpc.service.GenericService;

-import junit.framework.Assert;

+import org.junit.Assert;

 import org.junit.Ignore;

 import org.junit.Test;

 import org.springframework.beans.factory.BeanCreationException;

diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
new file mode 100644
index 0000000..11f7055
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring;
+
+import com.alibaba.dubbo.config.annotation.Service;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.mockito.Mockito.mock;
+
+public class ServiceBeanTest {
+    @Test
+    public void testGetService() {
+        TestService service = mock(TestService.class);
+        ServiceBean serviceBean = new ServiceBean(service);
+
+        Service beanService = serviceBean.getService();
+        Assert.assertThat(beanService, not(nullValue()));
+    }
+
+    abstract class TestService implements Service {
+
+    }
+}
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
index 01dbc53..a1b5807 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java
@@ -36,6 +36,10 @@
 import java.util.Map;
 
 import static com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.BEAN_NAME;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * {@link ReferenceAnnotationBeanPostProcessor} Test
@@ -174,6 +178,25 @@
 
     }
 
+    @Test
+    public void testModuleInfo() {
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TestBean.class);
+
+        ReferenceAnnotationBeanPostProcessor beanPostProcessor = context.getBean(BEAN_NAME,
+                ReferenceAnnotationBeanPostProcessor.class);
+
+
+        Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> referenceBeanMap =
+                beanPostProcessor.getInjectedMethodReferenceBeanMap();
+
+        for (Map.Entry<InjectionMetadata.InjectedElement, ReferenceBean<?>> entry : referenceBeanMap.entrySet()) {
+            ReferenceBean<?> referenceBean = entry.getValue();
+
+            assertThat(referenceBean.getModule().getName(),is("defaultModule"));
+            assertThat(referenceBean.getMonitor(), not(nullValue()));
+        }
+    }
+
     private static class AncestorBean {
 
 
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java
new file mode 100644
index 0000000..7b86652
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.schema;
+
+import com.alibaba.dubbo.config.ApplicationConfig;
+import com.alibaba.dubbo.config.ModuleConfig;
+import com.alibaba.dubbo.config.MonitorConfig;
+import com.alibaba.dubbo.config.ProtocolConfig;
+import com.alibaba.dubbo.config.ProviderConfig;
+import com.alibaba.dubbo.config.spring.ConfigTest;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import com.alibaba.dubbo.config.spring.api.DemoService;
+import com.alibaba.dubbo.config.spring.impl.DemoServiceImpl;
+import org.junit.Test;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class DubboNamespaceHandlerTest {
+    @Test
+    public void testProviderXml() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/demo-provider.xml");
+        ctx.start();
+
+        ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+        assertThat(protocolConfig, not(nullValue()));
+        assertThat(protocolConfig.getName(), is("dubbo"));
+        assertThat(protocolConfig.getPort(), is(20813));
+
+        ApplicationConfig applicationConfig = ctx.getBean(ApplicationConfig.class);
+        assertThat(applicationConfig, not(nullValue()));
+        assertThat(applicationConfig.getName(), is("demo-provider"));
+
+        DemoService service = ctx.getBean(DemoService.class);
+        assertThat(service, not(nullValue()));
+    }
+
+    @Test
+    public void testMultiProtocol() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-protocol.xml");
+        ctx.start();
+
+        Map<String, ProtocolConfig> protocolConfigMap = ctx.getBeansOfType(ProtocolConfig.class);
+        assertThat(protocolConfigMap.size(), is(2));
+
+        ProtocolConfig rmiProtocolConfig = protocolConfigMap.get("rmi");
+        assertThat(rmiProtocolConfig.getPort(), is(10991));
+
+        ProtocolConfig dubboProtocolConfig = protocolConfigMap.get("dubbo");
+        assertThat(dubboProtocolConfig.getPort(), is(20881));
+    }
+
+    @Test
+    public void testDefaultProtocol() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/override-protocol.xml");
+        ctx.start();
+
+        ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+        assertThat(protocolConfig.getName(), is("dubbo"));
+    }
+
+    @Test
+    public void testCustomParameter() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/customize-parameter.xml");
+        ctx.start();
+
+        ProtocolConfig protocolConfig = ctx.getBean(ProtocolConfig.class);
+        assertThat(protocolConfig.getParameters().size(), is(1));
+        assertThat(protocolConfig.getParameters().get("protocol-paramA"), is("protocol-paramA"));
+
+        ServiceBean serviceBean = ctx.getBean(ServiceBean.class);
+        assertThat(serviceBean.getParameters().size(), is(1));
+        assertThat(serviceBean.getParameters().get("service-paramA"), is("service-paramA"));
+    }
+
+
+    @Test
+    public void testDelayFixedTime() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/delay-fixed-time.xml");
+        ctx.start();
+
+        assertThat(ctx.getBean(ServiceBean.class).getDelay(), is(300));
+    }
+
+    @Test
+    public void testTimeoutConfig() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-nested-service.xml");
+        ctx.start();
+
+        Map<String, ProviderConfig> providerConfigMap = ctx.getBeansOfType(ProviderConfig.class);
+
+        assertThat(providerConfigMap.get("com.alibaba.dubbo.config.ProviderConfig").getTimeout(), is(2000));
+    }
+
+    @Test
+    public void testMonitor() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-with-monitor.xml");
+        ctx.start();
+
+        assertThat(ctx.getBean(MonitorConfig.class), not(nullValue()));
+    }
+
+    @Test(expected = BeanCreationException.class)
+    public void testMultiMonitor() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-monitor.xml");
+        ctx.start();
+    }
+
+    @Test(expected = BeanCreationException.class)
+    public void testMultiProviderConfig() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-multi.xml");
+        ctx.start();
+    }
+
+    @Test
+    public void testModuleInfo() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-with-module.xml");
+        ctx.start();
+
+        ModuleConfig moduleConfig = ctx.getBean(ModuleConfig.class);
+        assertThat(moduleConfig.getName(), is("test-module"));
+    }
+
+    @Test(expected = BeanCreationException.class)
+    public void testNotificationWithWrongBean() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/consumer-notification.xml");
+        ctx.start();
+    }
+
+    @Test
+    public void testProperty() {
+        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/service-class.xml");
+        ctx.start();
+
+        ServiceBean serviceBean = ctx.getBean(ServiceBean.class);
+
+        String prefix = ((DemoServiceImpl) serviceBean.getRef()).getPrefix();
+        assertThat(prefix, is("welcome:"));
+    }
+}
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java
new file mode 100644
index 0000000..27ef380
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/DataSourceStatusCheckerTest.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.status;
+
+import com.alibaba.dubbo.common.status.Status;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.springframework.context.ApplicationContext;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class DataSourceStatusCheckerTest {
+    private DataSourceStatusChecker dataSourceStatusChecker;
+
+    @Mock
+    private ApplicationContext applicationContext;
+
+    @Before
+    public void setUp() throws Exception {
+        initMocks(this);
+        this.dataSourceStatusChecker = new DataSourceStatusChecker();
+        new ServiceBean<Object>().setApplicationContext(applicationContext);
+    }
+
+    @Test
+    public void testWithoutApplicationContext() {
+        Status status = dataSourceStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+    }
+
+    @Test
+    public void testWithoutDatasource() {
+        Map<String, DataSource> map = new HashMap<String, DataSource>();
+        given(applicationContext.getBeansOfType(eq(DataSource.class), anyBoolean(), anyBoolean())).willReturn(map);
+
+        Status status = dataSourceStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+    }
+
+    @Test
+    public void testWithDatasourceHasNextResult() throws SQLException {
+        Map<String, DataSource> map = new HashMap<String, DataSource>();
+        DataSource dataSource = mock(DataSource.class);
+        Connection connection = mock(Connection.class, Answers.RETURNS_DEEP_STUBS);
+        given(dataSource.getConnection()).willReturn(connection);
+        given(connection.getMetaData().getTypeInfo().next()).willReturn(true);
+
+        map.put("mockDatabase", dataSource);
+        given(applicationContext.getBeansOfType(eq(DataSource.class), anyBoolean(), anyBoolean())).willReturn(map);
+        Status status = dataSourceStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.OK));
+    }
+
+    @Test
+    public void testWithDatasourceNotHasNextResult() throws SQLException {
+        Map<String, DataSource> map = new HashMap<String, DataSource>();
+        DataSource dataSource = mock(DataSource.class);
+        Connection connection = mock(Connection.class, Answers.RETURNS_DEEP_STUBS);
+        given(dataSource.getConnection()).willReturn(connection);
+        given(connection.getMetaData().getTypeInfo().next()).willReturn(false);
+
+        map.put("mockDatabase", dataSource);
+        given(applicationContext.getBeansOfType(eq(DataSource.class), anyBoolean(), anyBoolean())).willReturn(map);
+        Status status = dataSourceStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.ERROR));
+    }
+}
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java
new file mode 100644
index 0000000..1a57925
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/status/SpringStatusCheckerTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.dubbo.config.spring.status;
+
+import com.alibaba.dubbo.common.status.Status;
+import com.alibaba.dubbo.config.spring.ServiceBean;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.Lifecycle;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class SpringStatusCheckerTest {
+    private SpringStatusChecker springStatusChecker;
+
+    @Mock
+    private ApplicationContext applicationContext;
+
+    @Before
+    public void setUp() throws Exception {
+        initMocks(this);
+        this.springStatusChecker = new SpringStatusChecker();
+        new ServiceBean<Object>().setApplicationContext(applicationContext);
+    }
+
+    @Test
+    public void testWithoutApplicationContext() {
+        Status status = springStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
+    }
+
+    @Test
+    public void testWithLifeCycleRunning() {
+        ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class);
+        new ServiceBean<Object>().setApplicationContext(applicationLifeCycle);
+        given(applicationLifeCycle.getConfigLocations()).willReturn(new String[]{"test1", "test2"});
+        given(applicationLifeCycle.isRunning()).willReturn(true);
+
+        Status status = springStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.OK));
+        assertThat(status.getMessage(), is("test1,test2"));
+    }
+
+    @Test
+    public void testWithoutLifeCycleRunning() {
+        ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class);
+        new ServiceBean<Object>().setApplicationContext(applicationLifeCycle);
+        given(applicationLifeCycle.isRunning()).willReturn(false);
+
+        Status status = springStatusChecker.check();
+
+        assertThat(status.getLevel(), is(Status.Level.ERROR));
+    }
+
+    interface ApplicationLifeCycle extends Lifecycle, ApplicationContext {
+        String[] getConfigLocations();
+    }
+}
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
index d73c1e9..f69cc74 100644
--- a/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/META-INF/spring/dubbo-annotation-consumer.xml
@@ -26,5 +26,8 @@
 
     <!-- 连接注册中心配置 -->
     <dubbo:registry address="N/A"/>
+    <dubbo:monitor version="1.1"/>
+    <dubbo:module name="defaultModule"/>
+    <dubbo:consumer version="1.2.0"/>
 
 </beans>
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml
new file mode 100644
index 0000000..f6b7ccc
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/consumer-notification.xml
@@ -0,0 +1,32 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+    http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+    ">
+
+    <!-- current application configuration -->
+    <dubbo:application name="demo-consumer"/>
+
+    <!-- service reference configuration -->
+    <dubbo:reference id="demoService" interface="com.alibaba.dubbo.config.spring.api.DemoService">
+        <dubbo:method name="sayName" onreturn="notify.getBox" onthrow="notify.getBox" oninvoke="notify.getBox"/>
+    </dubbo:reference>
+
+</beans>
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
index d083bd2..0fc5cb2 100644
--- a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/delay-fixed-time.xml
@@ -21,15 +21,12 @@
     http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd

     ">

 

-    <!-- 当前应用信息配置 -->

     <dubbo:application name="demo-provider"/>

 

-    <!-- 连接注册中心配置 -->

-    <dubbo:registry address="127.0.0.1:4548"/>

+    <dubbo:registry address="N/A"/>

 

     <dubbo:protocol name="dubbo" port="20883"/>

 

-    <!-- 暴露服务配置 -->

     <dubbo:service interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService" delay="300"/>

 

     <bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>

diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml
new file mode 100644
index 0000000..badcc2a
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/multi-monitor.xml
@@ -0,0 +1,39 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+    http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+    ">
+
+    <dubbo:application name="service-class"/>
+
+    <dubbo:registry address="N/A"/>
+
+    <dubbo:protocol name="dubbo" port="20887"/>
+
+    <dubbo:provider timeout="2000"/>
+
+    <dubbo:service id="serviceConfig" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+    <dubbo:monitor version="1.1"/>
+    <dubbo:monitor version="1.2"/>
+
+    <bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml
new file mode 100644
index 0000000..6a2d2e9
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-multi.xml
@@ -0,0 +1,45 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+    http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+    ">
+
+    <dubbo:application name="service-class"/>
+
+    <dubbo:registry address="N/A"/>
+
+    <dubbo:protocol name="dubbo" port="20887"/>
+
+    <dubbo:provider timeout="2000"/>
+
+    <dubbo:service id="serviceConfig" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+    <dubbo:provider timeout="1000" default="true" delay="1000">
+        <dubbo:service id="serviceConfig2" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+                       group="demo2"/>
+    </dubbo:provider>
+    <dubbo:provider default="true" delay="500">
+        <dubbo:service interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+                       group="demo2"/>
+    </dubbo:provider>
+
+    <bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml
new file mode 100644
index 0000000..faaee83
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-module.xml
@@ -0,0 +1,43 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+    http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+    ">
+
+    <dubbo:application name="service-class"/>
+
+    <dubbo:registry address="N/A"/>
+
+    <dubbo:protocol name="dubbo" port="20887"/>
+
+    <dubbo:provider timeout="2000"/>
+
+    <dubbo:service id="serviceConfig" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+
+    <!-- nested configuration -->
+    <dubbo:provider timeout="1000">
+        <dubbo:service id="serviceConfig2" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"
+                       group="demo2"/>
+    </dubbo:provider>
+    <dubbo:module name="test-module" version="1.1"/>
+
+    <bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml
new file mode 100644
index 0000000..86c860e
--- /dev/null
+++ b/dubbo-config/dubbo-config-spring/src/test/resources/com/alibaba/dubbo/config/spring/provider-with-monitor.xml
@@ -0,0 +1,37 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+       xmlns="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+    http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd
+    ">
+
+    <dubbo:application name="service-class"/>
+
+    <dubbo:registry address="N/A"/>
+
+    <dubbo:protocol name="dubbo" port="20887"/>
+
+    <dubbo:provider timeout="2000"/>
+
+    <dubbo:service id="serviceConfig" interface="com.alibaba.dubbo.config.spring.api.DemoService" ref="demoService"/>
+    <dubbo:monitor default="true"/>
+
+    <bean id="demoService" class="com.alibaba.dubbo.config.spring.impl.DemoServiceImpl"/>
+
+</beans>
\ No newline at end of file