You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by il...@apache.org on 2019/06/19 07:42:43 UTC

[dubbo-samples] branch master updated: integration test for dubbo-samples-configcenter-externalconfiguration

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/dubbo-samples.git


The following commit(s) were added to refs/heads/master by this push:
     new 25fb55e  integration test for dubbo-samples-configcenter-externalconfiguration
25fb55e is described below

commit 25fb55ec1a6e9dc8640eb7da66ab01b9634f3494
Author: beiwei.ly <be...@alibaba-inc.com>
AuthorDate: Wed Jun 19 15:41:52 2019 +0800

    integration test for dubbo-samples-configcenter-externalconfiguration
---
 .../pom.xml                                        | 413 ++++++++-------------
 .../consumer/AnnotationAction.java                 |   4 +-
 .../consumer/AnnotationConsumer.java               |  18 +-
 .../provider/AnnotationProvider.java               |  26 +-
 .../service/AnnotationService.java                 |   3 -
 .../service/AnnotationServiceImpl.java             |   3 -
 .../spring/MyEnvironmentPostProcessor.java         |   5 +-
 .../dubbo-properties-in-configcenter.properties    |  12 +-
 .../AnnotationServiceIT.java}                      |  31 +-
 9 files changed, 199 insertions(+), 316 deletions(-)

diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/pom.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/pom.xml
index b382c27..5e34337 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/pom.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/pom.xml
@@ -31,304 +31,193 @@
     <properties>
         <source.level>1.8</source.level>
         <target.level>1.8</target.level>
+        <dubbo.version>2.7.2</dubbo.version>
         <spring.version>4.3.16.RELEASE</spring.version>
-        <dubbo.version>2.7.0</dubbo.version>
-        <dubbo.rpc.version>2.7.0</dubbo.rpc.version>
-        <zookeeper.version>3.4.13</zookeeper.version>
-        <curator.version>4.0.1</curator.version>
-        <validation-api.version>1.1.0.Final</validation-api.version>
-        <hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
-        <resteasy.version>3.0.19.Final</resteasy.version>
-        <curator-client.version>4.0.1</curator-client.version>
-        <swagger.version>1.5.19</swagger.version>
-        <tomcat.version>7.0.88</tomcat.version>
-        <servlet.version>3.0.1</servlet.version>
-        <maven_checkstyle_version>3.0.0</maven_checkstyle_version>
-        <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
-        <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+        <spring.boot.version>1.5.21.RELEASE</spring.boot.version>
+        <junit.version>4.12</junit.version>
+        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+        <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
+        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+        <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
+        <image.name>${artifactId}:${dubbo.version}</image.name>
+        <dubbo.port>20880</dubbo.port>
+        <zookeeper.port>2181</zookeeper.port>
+        <main-class>org.apache.dubbo.samples.externalconfiguration.provider.AnnotationProvider</main-class>
     </properties>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework</groupId>
-                <artifactId>spring-framework-bom</artifactId>
-                <version>${spring.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <!-- Import dependency management from Spring Boot -->
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring-boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>io.netty</groupId>
-                <artifactId>netty-all</artifactId>
-                <version>4.1.16.Final</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo-bom</artifactId>
-                <version>${dubbo.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo</artifactId>
-                <version>${dubbo.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.thrift</groupId>
-                        <artifactId>libthrift</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo-rpc-rest</artifactId>
-                <version>${dubbo.rpc.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.zookeeper</groupId>
-                <artifactId>zookeeper</artifactId>
-                <version>${zookeeper.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-framework</artifactId>
-                <version>${curator.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.validation</groupId>
-                <artifactId>validation-api</artifactId>
-                <version>${validation-api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.hibernate</groupId>
-                <artifactId>hibernate-validator</artifactId>
-                <version>${hibernate-validator.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>resteasy-jackson-provider</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-client</artifactId>
-                <version>${curator-client.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.servlet</groupId>
-                <artifactId>javax.servlet-api</artifactId>
-                <version>${servlet.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-core</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-logging-juli</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <!-- swagger -->
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-annotations</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-jaxrs</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-framework</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>io.netty</groupId>
-                    <artifactId>netty</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.zookeeper</groupId>
-                    <artifactId>zookeeper</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo</artifactId>
+            <version>${dubbo.version}</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-configcenter-zookeeper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-all</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
+            <artifactId>dubbo-dependencies-zookeeper</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+            <exclusions>
+                <exclusion>
+                    <groupId> org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
+
         <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-configcenter-zookeeper</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
         </dependency>
+
         <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-metadata-report-api</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <version>${spring.boot.version}</version>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
-            <version>1.5.18.RELEASE</version>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <version>${spring.boot.version}</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-maven-plugin</artifactId>
-                    <version>${spring-boot.version}</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.7.0</version>
-                <configuration>
-                    <source>${source.level}</source>
-                    <target>${target.level}</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <version>${apache-rat-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>verify.rat</id>
-                        <phase>verify</phase>
-                        <goals>
-                            <goal>check</goal>
-                        </goals>
-                        <configuration>
-                            <excludes>
-                                <exclude>**/*.versionsBackup</exclude>
-                                <exclude>**/.idea/</exclude>
-                                <exclude>**/*.iml</exclude>
-                                <exclude>**/*.txt</exclude>
-                                <exclude>**/*.load</exclude>
-                                <exclude>**/*.flex</exclude>
-                                <exclude>**/*.fc</exclude>
-                                <exclude>**/*.javascript</exclude>
-                                <exclude>**/*.properties</exclude>
-                                <exclude>**/*.thrift</exclude>
-                                <exclude>**/*.sh</exclude>
-                                <exclude>**/*.bat</exclude>
-                                <exclude>**/*.md</exclude>
-                                <exclude>.git/</exclude>
-                                <exclude>.gitignore</exclude>
-                                <!-- ASF jenkins box puts the Maven repo in our root directory. -->
-                                <exclude>.repository/</exclude>
-                                <exclude>**/.settings/*</exclude>
-                                <exclude>**/.classpath</exclude>
-                                <exclude>**/.project</exclude>
-                                <exclude>**/target/**</exclude>
-                                <exclude>**/*.log</exclude>
-                                <exclude>CODE_OF_CONDUCT.md</exclude>
-                                <exclude>.codecov.yml</exclude>
-                                <exclude>.travis.yml</exclude>
-                                <exclude>PULL_REQUEST_TEMPLATE.md</exclude>
-                                <exclude>CONTRIBUTING.md</exclude>
-                                <exclude>README.md</exclude>
-                                <exclude>**/codestyle/*</exclude>
-                                <exclude>**/resources/META-INF/**</exclude>
-                                <exclude>**/webapp/swagger/**</exclude>
-                                <exclude>**/org/apache/dubbo/samples/rpc/nativethrift/api/DemoService.java</exclude>
-                            </excludes>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
     <profiles>
         <profile>
-            <id>checkstyle</id>
-            <activation>
-                <jdk>[1.8,)</jdk>
-            </activation>
+            <id>dubbo-integration-test</id>
             <build>
                 <plugins>
                     <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-checkstyle-plugin</artifactId>
-                        <version>${maven_checkstyle_version}</version>
-                        <dependencies>
-                            <dependency>
-                                <groupId>com.puppycrawl.tools</groupId>
-                                <artifactId>checkstyle</artifactId>
-                                <version>8.9</version>
-                            </dependency>
-                        </dependencies>
+                        <groupId>org.apache.dubbo</groupId>
+                        <artifactId>dubbo-maven-address-plugin</artifactId>
+                        <version>1.0-SNAPSHOT</version>
                         <executions>
                             <execution>
-                                <id>checkstyle-validation</id>
-                                <phase>validate</phase>
+                                <goals>
+                                    <goal>local-address</goal>
+                                </goals>
                                 <configuration>
-                                    <configLocation>../../codestyle/checkstyle.xml</configLocation>
-                                    <suppressionsLocation>../../codestyle/checkstyle-suppressions.xml</suppressionsLocation>
-                                    <encoding>UTF-8</encoding>
-                                    <consoleOutput>true</consoleOutput>
-                                    <failOnViolation>true</failOnViolation>
+                                    <localAddress>dubbo-local-address</localAddress>
                                 </configuration>
+                                <phase>initialize</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>com.google.cloud.tools</groupId>
+                        <artifactId>jib-maven-plugin</artifactId>
+                        <version>${jib-maven-plugin.version}</version>
+                        <configuration>
+                            <from>
+                                <image>openjdk:8</image>
+                            </from>
+                            <to>
+                                <image>${image.name}</image>
+                            </to>
+                            <container>
+                                <mainClass>${main-class}</mainClass>
+                                <ports>
+                                    <port>${dubbo.port}</port>
+                                    <port>${zookeeper.port}</port>
+                                </ports>
+                                <environment>
+                                    <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+                                </environment>
+                                <jvmFlags>
+                                    <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
+                                </jvmFlags>
+                            </container>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
                                 <goals>
-                                    <goal>check</goal>
+                                    <goal>dockerBuild</goal>
                                 </goals>
                             </execution>
                         </executions>
                     </plugin>
+
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>${docker-maven-plugin.version}</version>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <name>${image.name}</name>
+                                    <run>
+                                        <ports>
+                                            <port>${dubbo.port}:${dubbo.port}</port>
+                                            <port>${zookeeper.port}:${zookeeper.port}</port>
+                                        </ports>
+                                        <wait>
+                                            <log>dubbo service started</log>
+                                        </wait>
+                                    </run>
+                                </image>
+                            </images>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>start</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>start</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>stop</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <version>${maven-failsafe-plugin.version}</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+                                    </systemPropertyVariables>
+                                    <includes>
+                                        <include>**/*IT.java</include>
+                                    </includes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                 </plugins>
             </build>
         </profile>
     </profiles>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven-compiler-plugin.version}</version>
+                <configuration>
+                    <source>${source.level}</source>
+                    <target>${target.level}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationAction.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationAction.java
index ce813d3..de575e6 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationAction.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationAction.java
@@ -21,11 +21,9 @@ package org.apache.dubbo.samples.externalconfiguration.consumer;
 
 import org.apache.dubbo.config.annotation.Reference;
 import org.apache.dubbo.samples.externalconfiguration.service.AnnotationService;
+
 import org.springframework.stereotype.Component;
 
-/**
- * AnnotationAction
- */
 @Component("annotationAction")
 public class AnnotationAction {
 
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationConsumer.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationConsumer.java
index 1c85c0e..abae253 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationConsumer.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/consumer/AnnotationConsumer.java
@@ -28,9 +28,6 @@ import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
-/**
- * CallbackConsumer
- */
 @SpringBootApplication
 @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.externalconfiguration.consumer")
 public class AnnotationConsumer {
@@ -40,27 +37,26 @@ public class AnnotationConsumer {
         AnnotationAction action = context.getBean(AnnotationAction.class);
 
         String result = action.doSayHello("world");
-        System.err.println("result :" + result);
+        System.out.println("result: " + result);
     }
 
-    /**
-     *
-     */
     @Configuration
     static public class ConsumerConfiguration {
 
         /**
-         * It's still required to initialize ConfigCenterBean, here we use the JavaBean method, but it doesn't matter which way you use, for example, xml or .properties are all ok.
+         * It's still required to initialize ConfigCenterBean, here we use the JavaBean method, but it doesn't matter
+         * which way you use, for example, xml or .properties are all ok.
          */
         @Bean
         public ConfigCenterBean configCenterBean() {
             ConfigCenterBean configCenterBean = new ConfigCenterBean();
             // This is a critical switch to tell Dubbo framework to get configs from standard Spring Environment
             configCenterBean.setIncludeSpringEnv(true);
-            configCenterBean.setConfigFile("dubbo.properties");// by default is dubbo.properties
-            configCenterBean.setAppConfigFile("configcenter-annotation-provider.dubbo.properties"); // by default is application.dubbo.properties
+            // by default is dubbo.properties
+            configCenterBean.setConfigFile("dubbo.properties");
+            // by default is application.dubbo.properties
+            configCenterBean.setAppConfigFile("configcenter-annotation-provider.dubbo.properties");
             return configCenterBean;
         }
-
     }
 }
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/provider/AnnotationProvider.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/provider/AnnotationProvider.java
index 1fcb1a1..1b4d2cf 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/provider/AnnotationProvider.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/provider/AnnotationProvider.java
@@ -29,9 +29,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
-/**
- * MergeProvider
- */
+import java.util.concurrent.CountDownLatch;
+
 @SpringBootApplication
 @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.externalconfiguration.service")
 public class AnnotationProvider {
@@ -41,32 +40,33 @@ public class AnnotationProvider {
         new EmbeddedZooKeeper(2181, false).start();
 
         SpringApplication.run(AnnotationProvider.class, args);
-        System.in.read();
+        System.out.println("dubbo service started");
+        new CountDownLatch(1).await();
     }
 
     @Configuration
     static public class ProviderConfiguration {
 
         /**
-         * It's still required to initialize ConfigCenterBean, here we use the JavaBean method, but it doesn't matter which way you use, which means xml or .properties are all ok to go.
-         * <p>
-         * Notice that if you have a
+         * It's still required to initialize ConfigCenterBean, here we use the JavaBean method, but it doesn't matter
+         * which way you use, which means xml or .properties are all ok to go.
          */
         @Bean
         public ConfigCenterBean configCenterBean() {
             ConfigCenterBean configCenterBean = new ConfigCenterBean();
             // This is a critical switch to tell Dubbo framework to get configs from standard Spring Environment
             configCenterBean.setIncludeSpringEnv(true);
-            configCenterBean.setConfigFile("dubbo.properties");// by default is dubbo.properties
-            configCenterBean.setAppConfigFile("configcenter-annotation-provider.dubbo.properties"); // by default is application.dubbo.properties
+            // by default is dubbo.properties
+            configCenterBean.setConfigFile("dubbo.properties");
+            // by default is application.dubbo.properties
+            configCenterBean.setAppConfigFile("configcenter-annotation-provider.dubbo.properties");
             return configCenterBean;
         }
 
         /**
          * It's ok to have local configuration for each part, there's nothing different with 2.6.x regarding this part.
-         * It's only a matter of priority, by default, the external configuration (loaded from standard Spring Environment in this sample) has a higher priority than the local configuration.
-         *
-         * @return
+         * It's only a matter of priority, by default, the external configuration (loaded from standard Spring
+         * Environment in this sample) has a higher priority than the local configuration.
          */
         @Bean
         public ProviderConfig providerConfig() {
@@ -74,7 +74,5 @@ public class AnnotationProvider {
             providerConfig.setTimeout(6666);
             return providerConfig;
         }
-
     }
-
 }
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationService.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationService.java
index a70bd14..72a2655 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationService.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationService.java
@@ -16,9 +16,6 @@
  */
 package org.apache.dubbo.samples.externalconfiguration.service;
 
-/**
- *
- */
 public interface AnnotationService {
 
     String sayHello(String name);
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java
index 2bddf9f..ea109dd 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java
@@ -18,9 +18,6 @@ package org.apache.dubbo.samples.externalconfiguration.service;
 
 import org.apache.dubbo.config.annotation.Service;
 
-/**
- *
- */
 @Service
 public class AnnotationServiceImpl implements AnnotationService {
 
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/spring/MyEnvironmentPostProcessor.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/spring/MyEnvironmentPostProcessor.java
index 7ab7257..b926113 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/spring/MyEnvironmentPostProcessor.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/spring/MyEnvironmentPostProcessor.java
@@ -29,7 +29,8 @@ import java.util.stream.Collectors;
 
 /**
  *
- * The users are responsible for gathering all Dubbo related configurations and put them into the standard Spring environment mapping to a specified key, in this demo is 'dubbo.properties' and 'application.dubbo.properties'.
+ * The users are responsible for gathering all Dubbo related configurations and put them into the standard
+ * Spring environment mapping to a specified key, in this demo is 'dubbo.properties' and 'application.dubbo.properties'.
  */
 public class MyEnvironmentPostProcessor implements EnvironmentPostProcessor {
 
@@ -63,4 +64,4 @@ public class MyEnvironmentPostProcessor implements EnvironmentPostProcessor {
             e.printStackTrace();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/resources/yourconfigcenter/dubbo-properties-in-configcenter.properties b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/resources/yourconfigcenter/dubbo-properties-in-configcenter.properties
index 6968ba5..781c81e 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/resources/yourconfigcenter/dubbo-properties-in-configcenter.properties
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/resources/yourconfigcenter/dubbo-properties-in-configcenter.properties
@@ -6,18 +6,18 @@
 #   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.
-#  
 #
-dubbo.config-center.address=zookeeper://127.0.0.1:2181
-dubbo.registry.address=zookeeper://127.0.0.1:2181
+#
+dubbo.config-center.address=zookeeper://${zookeeper.address:127.0.0.1}:2181
+dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181
 dubbo.protocol.name=dubbo
 dubbo.protocol.port=20880
-dubbo.consumer.timeout=3000
\ No newline at end of file
+dubbo.consumer.timeout=3000
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/test/java/org/apache/dubbo/samples/externalconfiguration/AnnotationServiceIT.java
similarity index 50%
copy from dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java
copy to dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/test/java/org/apache/dubbo/samples/externalconfiguration/AnnotationServiceIT.java
index 2bddf9f..74873c3 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/main/java/org/apache/dubbo/samples/externalconfiguration/service/AnnotationServiceImpl.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-externalconfiguration/src/test/java/org/apache/dubbo/samples/externalconfiguration/AnnotationServiceIT.java
@@ -14,20 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.externalconfiguration.service;
 
-import org.apache.dubbo.config.annotation.Service;
+package org.apache.dubbo.samples.externalconfiguration;
 
-/**
- *
- */
-@Service
-public class AnnotationServiceImpl implements AnnotationService {
+import org.apache.dubbo.samples.externalconfiguration.consumer.AnnotationAction;
+import org.apache.dubbo.samples.externalconfiguration.consumer.AnnotationConsumer;
 
-    @Override
-    public String sayHello(String name) {
-        System.out.println("async provider received: " + name);
-        return "annotation: hello, " + name;
-    }
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
 
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {AnnotationConsumer.class})
+public class AnnotationServiceIT {
+    @Autowired
+    private AnnotationAction annotationAction;
+
+    @Test
+    public void test() throws Exception {
+        Assert.assertEquals("annotation: hello, dubbo", annotationAction.doSayHello("dubbo"));
+    }
 }


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