Просмотр исходного кода

支持spring-boot 以及迁移demos代码

knightliao 9 лет назад
Родитель
Сommit
34704984d8
97 измененных файлов с 216 добавлено и 3217 удалено
  1. 5 5
      disconf-client/src/main/java/com/baidu/disconf/client/common/model/DisconfCenterFile.java
  2. 2 2
      disconf-client/src/main/java/com/baidu/disconf/client/config/inner/DisInnerConfigHelper.java
  3. 38 0
      disconf-client/src/test/java/com/baidu/disconf/client/test/utils/TestAntPathMatcher.java
  4. 0 23
      disconf-core/src/main/java/com/baidu/disconf/core/common/restful/impl/RestfulMgrImpl.java
  5. 0 8
      disconf-demos/.gitignore
  6. 0 10
      disconf-demos/disconf-spring-boot-demo/.gitignore
  7. 0 46
      disconf-demos/disconf-spring-boot-demo/README.md
  8. 0 10
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/.gitignore
  9. 70 0
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/disconf-spring-boot-core.iml
  10. 0 67
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/pom.xml
  11. 0 31
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/callbacks/SimpleDemoServiceUpdateCallback.java
  12. 0 45
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/config/SimpleConfig.java
  13. 0 51
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/service/SimpleDemoService.java
  14. 0 34
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/task/DisconfDemoTask.java
  15. 0 10
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/.gitignore
  16. 100 0
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/disconf-spring-boot-web.iml
  17. 0 53
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/pom.xml
  18. 0 29
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/Application.java
  19. 0 18
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/com/example/disconf/controller/HelloController.java
  20. 0 35
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/com/example/disconf/init/InstantiationTracingBeanPostProcessor.java
  21. 0 26
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/application.properties
  22. 0 25
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/disconf.properties
  23. 0 20
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/disconf.xml
  24. 0 58
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/logback.xml
  25. 0 2
      disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/simple.properties
  26. 0 26
      disconf-demos/disconf-spring-boot-demo/pom.xml
  27. 0 12
      disconf-demos/disconf-standalone-demo/.gitignore
  28. 0 4
      disconf-demos/disconf-standalone-demo/README.md
  29. 0 1
      disconf-demos/disconf-standalone-demo/conffiles/autoconfig.properties
  30. 0 1
      disconf-demos/disconf-standalone-demo/conffiles/autoconfig2.properties
  31. 0 1
      disconf-demos/disconf-standalone-demo/conffiles/code.properties
  32. 0 2
      disconf-demos/disconf-standalone-demo/conffiles/coefficients.properties
  33. 0 2
      disconf-demos/disconf-standalone-demo/conffiles/empty.properties
  34. 0 2
      disconf-demos/disconf-standalone-demo/conffiles/myserver.properties
  35. 0 3
      disconf-demos/disconf-standalone-demo/conffiles/myserver_slave.properties
  36. 0 2
      disconf-demos/disconf-standalone-demo/conffiles/redis.properties
  37. 0 2
      disconf-demos/disconf-standalone-demo/conffiles/remote.properties
  38. 0 1
      disconf-demos/disconf-standalone-demo/conffiles/static.properties
  39. 0 1
      disconf-demos/disconf-standalone-demo/conffiles/testJson.json
  40. 0 10
      disconf-demos/disconf-standalone-demo/conffiles/testXml.xml
  41. 0 10
      disconf-demos/disconf-standalone-demo/conffiles/testXml2.xml
  42. 0 25
      disconf-demos/disconf-standalone-demo/deploy/package-jar.xml
  43. 0 39
      disconf-demos/disconf-standalone-demo/deploy/package-tar.gz.xml
  44. 0 218
      disconf-demos/disconf-standalone-demo/pom.xml
  45. 0 40
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/DisconfDemoMain.java
  46. 0 25
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/CodeConfig.java
  47. 0 67
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/Coefficients.java
  48. 0 16
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/EmptyConf.java
  49. 0 65
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/JedisConfig.java
  50. 0 50
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/RemoteServerConfig.java
  51. 0 26
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/StaticConfig.java
  52. 0 16
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/TestXmlConfig.java
  53. 0 17
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/AutoService.java
  54. 0 17
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/AutoService2.java
  55. 0 66
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/BaoBaoService.java
  56. 0 54
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/RemoteService.java
  57. 0 81
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisService.java
  58. 0 34
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/SimpleStaticService.java
  59. 0 32
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/AutoServiceCallback.java
  60. 0 36
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/RemoteServiceUpdateCallback.java
  61. 0 39
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/SimpleRedisServiceUpdateCallback.java
  62. 0 17
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/TestJsonConfigCallback.java
  63. 0 18
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/TestXmlConfigCallback.java
  64. 0 100
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/task/DisconfDemoTask.java
  65. 0 33
      disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/utils/JedisUtil.java
  66. 0 80
      disconf-demos/disconf-standalone-demo/src/main/resources/applicationContext.xml
  67. 0 30
      disconf-demos/disconf-standalone-demo/src/main/resources/disconf.properties
  68. 0 58
      disconf-demos/disconf-standalone-demo/src/main/resources/logback.xml
  69. 0 10
      disconf-demos/disconf-standalone-dubbo-demo/.gitignore
  70. 0 4
      disconf-demos/disconf-standalone-dubbo-demo/README.md
  71. 0 25
      disconf-demos/disconf-standalone-dubbo-demo/deploy/package-jar.xml
  72. 0 39
      disconf-demos/disconf-standalone-dubbo-demo/deploy/package-tar.gz.xml
  73. 0 219
      disconf-demos/disconf-standalone-dubbo-demo/pom.xml
  74. 0 41
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/DisconfDemoMain.java
  75. 0 68
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/Coefficients.java
  76. 0 17
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/EmptyConf.java
  77. 0 53
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/JedisConfig.java
  78. 0 51
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/RemoteServerConfig.java
  79. 0 26
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/StaticConfig.java
  80. 0 28
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/consumer/Consumer.java
  81. 0 7
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/service/DubboService.java
  82. 0 17
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/service/impl/DubboServiceImpl.java
  83. 0 66
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/BaoBaoService.java
  84. 0 54
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/RemoteService.java
  85. 0 35
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/RemoteServiceUpdateCallback.java
  86. 0 80
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisService.java
  87. 0 38
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisServiceUpdateCallback.java
  88. 0 35
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleStaticService.java
  89. 0 67
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/task/DisconfDemoTask.java
  90. 0 33
      disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/utils/JedisUtil.java
  91. 0 62
      disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/applicationContext.xml
  92. 0 30
      disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/disconf.properties
  93. 0 23
      disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/dubbo-consumer.xml
  94. 0 25
      disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/dubbo-provider.xml
  95. 0 58
      disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/logback.xml
  96. 0 18
      disconf-demos/pom.xml
  97. 1 1
      pom.xml

+ 5 - 5
disconf-client/src/main/java/com/baidu/disconf/client/common/model/DisconfCenterFile.java

@@ -6,8 +6,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import com.baidu.disconf.client.common.constants.SupportFileTypeEnum;
-import com.github.knightliao.apollo.utils.config.ConfigLoaderUtils;
 import com.github.knightliao.apollo.utils.io.OsUtil;
+import com.github.knightliao.apollo.utils.tool.ClassLoaderUtil;
 
 /**
  * 配置文件表示
@@ -128,10 +128,10 @@ public class DisconfCenterFile extends DisconfCenterBaseModel {
                 return OsUtil.pathJoin(copy2TargetDirPath, fileName);
             }
 
-            return OsUtil.pathJoin(ConfigLoaderUtils.CLASS_PATH, copy2TargetDirPath, fileName);
+            return OsUtil.pathJoin(ClassLoaderUtil.getClassPath(), copy2TargetDirPath, fileName);
         }
 
-        return OsUtil.pathJoin(ConfigLoaderUtils.CLASS_PATH, fileName);
+        return OsUtil.pathJoin(ClassLoaderUtil.getClassPath(), fileName);
     }
 
     /**
@@ -146,10 +146,10 @@ public class DisconfCenterFile extends DisconfCenterBaseModel {
                 return OsUtil.pathJoin(copy2TargetDirPath);
             }
 
-            return OsUtil.pathJoin(ConfigLoaderUtils.CLASS_PATH, copy2TargetDirPath);
+            return OsUtil.pathJoin(ClassLoaderUtil.getClassPath(), copy2TargetDirPath);
         }
 
-        return ConfigLoaderUtils.CLASS_PATH;
+        return ClassLoaderUtil.getClassPath();
     }
 
     /**

+ 2 - 2
disconf-client/src/main/java/com/baidu/disconf/client/config/inner/DisInnerConfigHelper.java

@@ -11,8 +11,8 @@ import org.slf4j.LoggerFactory;
 import com.baidu.disconf.client.config.DisClientConfig;
 import com.baidu.disconf.client.config.DisClientSysConfig;
 import com.github.knightliao.apollo.utils.common.StringUtil;
-import com.github.knightliao.apollo.utils.config.ConfigLoaderUtils;
 import com.github.knightliao.apollo.utils.io.OsUtil;
+import com.github.knightliao.apollo.utils.tool.ClassLoaderUtil;
 
 /**
  * 用户配置、系统配置 的校验
@@ -157,7 +157,7 @@ public class DisInnerConfigHelper {
         // 是否将文件放在classpath目录下
         if (DisClientSysConfig.getInstance().ENABLE_LOCAL_DOWNLOAD_DIR_IN_CLASS_PATH) {
 
-            String classpath = ConfigLoaderUtils.CLASS_PATH;
+            String classpath = ClassLoaderUtil.getClassPath();
 
             if (classpath.isEmpty()) {
                 LOGGER.warn("CLASSPATH is null. we will not transfer your config file to classpath in the following");

+ 38 - 0
disconf-client/src/test/java/com/baidu/disconf/client/test/utils/TestAntPathMatcher.java

@@ -0,0 +1,38 @@
+package com.baidu.disconf.client.test.utils;
+
+import org.junit.Test;
+import org.springframework.util.AntPathMatcher;
+import org.springframework.util.PathMatcher;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by knightliao on 15/11/13.
+ */
+public class TestAntPathMatcher extends TestCase {
+
+    @Test
+    public void testUrlMatch() {
+
+        PathMatcher matcher = new AntPathMatcher();
+
+        //  完全路径url方式路径匹配
+        //  String requestPath="http://localhost:8080/pub/login.jsp";//请求路径
+
+        //  String patternPath="**/login.jsp";//路径匹配模式
+
+        //  不完整路径uri方式路径匹配
+        //  String requestPath="/app/pub/login.do";//请求路径
+        //  String patternPath="/**/login.do";//路径匹配模式
+        //  模糊路径方式匹配
+        //  String requestPath="/app/pub/login.do";//请求路径
+        //  String patternPath="/**/*.do";//路径匹配模式
+        //  包含模糊单字符路径匹配
+
+        String requestPath = "/app/pub/login.do";//请求路径
+        String patternPath = "/**/lo?in.do";//路径匹配模式
+
+        boolean result = matcher.match(patternPath, requestPath);
+        assertTrue(result);
+    }
+}

+ 0 - 23
disconf-core/src/main/java/com/baidu/disconf/core/common/restful/impl/RestfulMgrImpl.java

@@ -21,7 +21,6 @@ import com.baidu.disconf.core.common.restful.retry.RetryStrategy;
 import com.baidu.disconf.core.common.restful.type.FetchConfFile;
 import com.baidu.disconf.core.common.restful.type.RestfulGet;
 import com.baidu.disconf.core.common.utils.MyStringUtils;
-import com.github.knightliao.apollo.utils.config.ConfigLoaderUtils;
 import com.github.knightliao.apollo.utils.io.OsUtil;
 
 /**
@@ -280,26 +279,4 @@ public class RestfulMgrImpl implements RestfulMgr {
         throw new Exception("download failed.");
     }
 
-    /**
-     * 获取在CLASSPATH下的文件,如果找不到CLASSPATH,则返回null
-     *
-     * @param fileName
-     *
-     * @return File
-     *
-     * @throws Exception
-     * @Description:
-     * @author liaoqiqi
-     * @date 2013-6-20
-     */
-    private static File getLocalDownloadFileInClasspath(String fileName) throws Exception {
-
-        String classpath = ConfigLoaderUtils.CLASS_PATH;
-
-        if (classpath == null) {
-            return null;
-        }
-        return new File(OsUtil.pathJoin(classpath, fileName));
-    }
-
 }

+ 0 - 8
disconf-demos/.gitignore

@@ -1,8 +0,0 @@
-/.project
-/.settings
-/target
-/pom.xml.releaseBackup
-/*.iml
-/.idea
-/.DS_Store
-.idea

+ 0 - 10
disconf-demos/disconf-spring-boot-demo/.gitignore

@@ -1,10 +0,0 @@
-/.settings
-/target
-/.classpath
-/.project
-/.DS_Store
-/disconf
-/log
-/bin
-/*.iml
-.idea

+ 0 - 46
disconf-demos/disconf-spring-boot-demo/README.md

@@ -1,46 +0,0 @@
-disconf-spring-boot-demo
-=======
-使用disconf的spring-boot demo程序,更少的配置
-
-
-项目启动运行Application main方法
-
-    @Configuration
-    @EnableAutoConfiguration
-    @ComponentScan(basePackages = {"com.baidu","com.example"})
-    @PropertySource({"classpath:application.properties"})
-    @ImportResource({"classpath:disconf.xml"})//引入disconf
-    public class Application extends SpringBootServletInitializer {
-
-        public static void main(String[] args) {
-            SpringApplication.run(Application.class, args);
-        }
-
-        @Override
-        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-            return application.sources(Application.class);
-        }
-
-    }
-
-
-disconf.xml
-
-    <?xml version="1.0" encoding="UTF-8"?>
-    <beans xmlns="http://www.springframework.org/schema/beans"
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-           xsi:schemaLocation="http://www.springframework.org/schema/beans
-            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-            http://www.springframework.org/schema/aop
-            http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
-        <aop:aspectj-autoproxy proxy-target-class="true"/>
-
-        <!-- 使用disconf必须添加以下配置 -->
-        <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
-              destroy-method="destroy">
-            <property name="scanPackage" value="com.example.disconf"/>
-        </bean>
-        <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
-              init-method="init" destroy-method="destroy">
-        </bean>
-    </beans>

+ 0 - 10
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/.gitignore

@@ -1,10 +0,0 @@
-/.settings
-/target
-/.classpath
-/.project
-/.DS_Store
-/disconf
-/log
-/bin
-/*.iml
-.idea

+ 70 - 0
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/disconf-spring-boot-core.iml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.2" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.2" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.13" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.2" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.2" level="project" />
+    <orderEntry type="library" name="Maven: redis.clients:jedis:2.7.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.2" level="project" />
+    <orderEntry type="module" module-name="disconf-client" />
+    <orderEntry type="module" module-name="disconf-core" />
+    <orderEntry type="module" module-name="apollo" />
+    <orderEntry type="library" name="Maven: commons-pool:commons-pool:1.6" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:19.0-rc2" level="project" />
+    <orderEntry type="library" name="Maven: commons-io:commons-io:1.4" level="project" />
+    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.3.6" level="project" />
+    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
+    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
+    <orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+    <orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0-rc1" level="project" />
+    <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2-b02" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:asm-all-repackaged:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:cglib:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-jaxrs:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-xc:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
+    <orderEntry type="library" name="Maven: org.reflections:reflections:0.9.9-RC1" level="project" />
+    <orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" />
+    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjtools:1.8.2" level="project" />
+  </component>
+</module>
+

+ 0 - 67
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/pom.xml

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <parent>
-        <artifactId>disconf-spring-boot-demo</artifactId>
-        <groupId>com.baidu.disconf</groupId>
-        <version>1.0.0</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>disconf-spring-boot-core</artifactId>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>redis.clients</groupId>
-            <artifactId>jedis</artifactId>
-            <version>2.7.3</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.baidu.disconf</groupId>
-            <artifactId>disconf-client</artifactId>
-            <version>2.6.28-SNAPSHOT</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>ch.qos.logback</groupId>
-                    <artifactId>logback-core</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>ch.qos.logback</groupId>
-                    <artifactId>logback-classic</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 31
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/callbacks/SimpleDemoServiceUpdateCallback.java

@@ -1,31 +0,0 @@
-package com.example.disconf.callbacks;
-
-import com.example.disconf.config.SimpleConfig;
-import com.example.disconf.service.SimpleDemoService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-
-
-/**
- * 更新配置时的回调函数
- */
-@Service
-@DisconfUpdateService(classes = { SimpleConfig.class})
-public class SimpleDemoServiceUpdateCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory
-            .getLogger(SimpleDemoServiceUpdateCallback.class);
-
-    @Autowired
-    private SimpleDemoService simpleDemoService;
-
-    public void reload() throws Exception {
-        simpleDemoService.changeConfig();
-    }
-
-}

+ 0 - 45
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/config/SimpleConfig.java

@@ -1,45 +0,0 @@
-package com.example.disconf.config;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-@Service
-@Scope("singleton")
-@DisconfFile(filename = "simple.properties")
-public class SimpleConfig {
-    // 代表连接地址
-    private String host;
-
-    // 代表连接port
-    private int port;
-
-    /**
-     * 地址
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "host")
-    public String getHost() {
-        return host;
-    }
-
-    public void setHost(String host) {
-        this.host = host;
-    }
-
-    /**
-     * 端口
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "port")
-    public int getPort() {
-        return port;
-    }
-
-    public void setPort(int port) {
-        this.port = port;
-    }
-}

+ 0 - 51
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/service/SimpleDemoService.java

@@ -1,51 +0,0 @@
-package com.example.disconf.service;
-
-import com.example.disconf.config.SimpleConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-@Service
-@Scope("singleton")
-public class SimpleDemoService implements InitializingBean, DisposableBean {
-
-    protected static final Logger LOGGER = LoggerFactory
-            .getLogger(SimpleDemoService.class);
-
-
-    /**
-     * 分布式配置
-     */
-    @Autowired
-    private SimpleConfig simpleConfig;
-
-    /**
-     * 关闭
-     */
-    public void destroy() throws Exception {
-
-        LOGGER.info("destroy ==> ");
-    }
-
-    /**
-     * 进行连接
-     */
-    public void afterPropertiesSet() throws Exception {
-
-        LOGGER.info("connect ==> ");
-    }
-
-    /**
-     * 后台更改值
-     */
-    public void changeConfig() {
-
-        LOGGER.info("start to change hosts to: " + simpleConfig.getHost() + " : " + simpleConfig.getPort());
-
-        LOGGER.info("change ok.");
-    }
-}

+ 0 - 34
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-core/src/main/java/com/example/disconf/task/DisconfDemoTask.java

@@ -1,34 +0,0 @@
-package com.example.disconf.task;
-
-import com.example.disconf.config.SimpleConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * 定时输出配置修改
- */
-public class DisconfDemoTask implements Runnable{
-
-    protected static final Logger LOGGER = LoggerFactory
-            .getLogger(DisconfDemoTask.class);
-
-    private SimpleConfig simpleConfig;
-
-    public DisconfDemoTask(SimpleConfig simpleConfig){
-        this.simpleConfig = simpleConfig;
-    }
-
-    public void run() {
-        try {
-
-            while (true) {
-                Thread.sleep(5000);
-                LOGGER.info("simple config ==> host:{}, port:{} ",simpleConfig.getHost(),simpleConfig.getPort());
-            }
-
-        } catch (Exception e) {
-            LOGGER.error(e.toString(), e);
-        }
-    }
-}

+ 0 - 10
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/.gitignore

@@ -1,10 +0,0 @@
-/.settings
-/target
-/.classpath
-/.project
-/.DS_Store
-/disconf
-/log
-/bin
-/*.iml
-.idea

+ 100 - 0
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/disconf-spring-boot-web.iml

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="web" name="Web">
+      <configuration>
+        <webroots>
+          <root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
+        </webroots>
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="disconf-spring-boot-core" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.7" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.2" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.2" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.13" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.2" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.2" level="project" />
+    <orderEntry type="library" name="Maven: redis.clients:jedis:2.4.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.2" level="project" />
+    <orderEntry type="module" module-name="disconf-client" />
+    <orderEntry type="module" module-name="disconf-core" />
+    <orderEntry type="module" module-name="apollo" />
+    <orderEntry type="library" name="Maven: commons-pool:commons-pool:1.6" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:19.0-rc2" level="project" />
+    <orderEntry type="library" name="Maven: commons-io:commons-io:1.4" level="project" />
+    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.3.6" level="project" />
+    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
+    <orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
+    <orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+    <orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0-rc1" level="project" />
+    <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2-b02" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:asm-all-repackaged:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.hk2.external:cglib:2.1.64" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-jaxrs:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-xc:1.9.8" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.0-m13" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
+    <orderEntry type="library" name="Maven: org.reflections:reflections:0.9.9-RC1" level="project" />
+    <orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" />
+    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjtools:1.8.2" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:7.0.55" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:7.0.55" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-logging-juli:7.0.55" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.3.4" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.3.4" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.3.4" level="project" />
+    <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.0.3.Final" level="project" />
+    <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
+    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.1.1.GA" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.0.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.0.7.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:1.1.7.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.9.5" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.0.7.RELEASE" level="project" />
+  </component>
+</module>
+

+ 0 - 53
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/pom.xml

@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <parent>
-        <artifactId>disconf-spring-boot-demo</artifactId>
-        <groupId>com.baidu.disconf</groupId>
-        <version>1.0.0</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <packaging>war</packaging>
-    <artifactId>disconf-spring-boot-web</artifactId>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.baidu.disconf</groupId>
-            <artifactId>disconf-spring-boot-core</artifactId>
-            <version>${parent.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <configuration>
-                    <failOnMissingWebXml>false</failOnMissingWebXml>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 29
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/Application.java

@@ -1,29 +0,0 @@
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.web.SpringBootServletInitializer;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.ImportResource;
-import org.springframework.context.annotation.PropertySource;
-
-/**
- * Created by wenjl on 2015/8/5.
- */
-@Configuration
-@EnableAutoConfiguration
-@ComponentScan(basePackages = {"com.baidu","com.example"})
-@PropertySource({"classpath:application.properties"})
-@ImportResource({"classpath:disconf.xml"})//引入disconf
-public class Application extends SpringBootServletInitializer {
-
-    public static void main(String[] args) {
-        SpringApplication.run(Application.class, args);
-    }
-
-    @Override
-    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-        return application.sources(Application.class);
-    }
-
-}

+ 0 - 18
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/com/example/disconf/controller/HelloController.java

@@ -1,18 +0,0 @@
-package com.example.disconf.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-/**
- * Created by wenjl on 2015/8/5.
- */
-@Controller
-public class HelloController {
-
-    @RequestMapping("/")
-    @ResponseBody
-    String home() {
-        return "Hello World!";
-    }
-}

+ 0 - 35
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/java/com/example/disconf/init/InstantiationTracingBeanPostProcessor.java

@@ -1,35 +0,0 @@
-package com.example.disconf.init;
-
-
-import com.example.disconf.config.SimpleConfig;
-import com.example.disconf.task.DisconfDemoTask;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.event.ContextRefreshedEvent;
-
-/**
- * spring初始化结束后,执行
- * @author wenjl
- */
-@Configuration
-public class InstantiationTracingBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent>
-{
-    protected static final Logger LOGGER = LoggerFactory
-            .getLogger(InstantiationTracingBeanPostProcessor.class);
-
-    @Override
-    public void onApplicationEvent(ContextRefreshedEvent event)
-    {
-        if(event.getApplicationContext().getParent() == null)//root applicationContext没有parent,保证是统一的context
-        {
-            LOGGER.info("init thread...");
-            new Thread(new DisconfDemoTask(simpleConfig)).start();
-        }
-    }
-
-    @Autowired
-    private SimpleConfig simpleConfig;
-}

+ 0 - 26
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/application.properties

@@ -1,26 +0,0 @@
-spring.config.name=application
-spring.main.show-banner=false
-server.port=8081
-server.session-timeout=1800
-server.servlet-path=/
-server.tomcat.basedir=/tmp
-server.tomcat.uri-encoding = UTF-8
-
-http.client.socketTimeout=5
-http.client.connectionRequestTimeout=5
-http.client.connectionTimeout=5
-http.client.closeIdleConnections=30
-
-# MVC
-spring.view.prefix=/WEB-INF/views/
-spring.view.suffix=.jsp
-
-#jmx
-spring.jmx.enabled=false
-
-#multipart
-spring.multipart.enabled=true
-# File size limit
-multipart.maxFileSize = 20Mb
-# Total request size for a multipart/form-data
-multipart.maxRequestSize = 20Mb

+ 0 - 25
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/disconf.properties

@@ -1,25 +0,0 @@
-# \u662F\u5426\u4F7F\u7528\u8FDC\u7A0B\u914D\u7F6E\u6587\u4EF6
-# true(\u9ED8\u8BA4)\u4F1A\u4ECE\u8FDC\u7A0B\u83B7\u53D6\u914D\u7F6E false\u5219\u76F4\u63A5\u83B7\u53D6\u672C\u5730\u914D\u7F6E
-disconf.enable.remote.conf=true
-
-#
-# \u914D\u7F6E\u670D\u52A1\u5668\u7684 HOST,\u7528\u9017\u53F7\u5206\u9694  127.0.0.1:8000,127.0.0.1:8000
-#
-disconf.conf_server_host=127.0.0.1:8080
-
-# \u7248\u672C, \u8BF7\u91C7\u7528 X_X_X_X \u683C\u5F0F
-disconf.version=1_0_0_0
-
-# APP \u8BF7\u91C7\u7528 \u4EA7\u54C1\u7EBF_\u670D\u52A1\u540D \u683C\u5F0F
-disconf.app=spring-boot-disconf
-
-# \u73AF\u5883
-disconf.env=rd
-
-# \u5FFD\u7565\u54EA\u4E9B\u5206\u5E03\u5F0F\u914D\u7F6E\uFF0C\u7528\u9017\u53F7\u5206\u9694
-disconf.ignore=
-
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u6B21\u6570\uFF0C\u9ED8\u8BA4\u662F3\u6B21
-disconf.conf_server_url_retry_times=1
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u65F6\u4F11\u7720\u65F6\u95F4\uFF0C\u9ED8\u8BA4\u662F5\u79D2
-disconf.conf_server_url_retry_sleep_seconds=1

+ 0 - 20
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/disconf.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-        http://www.springframework.org/schema/aop
-        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
-
-    <aop:aspectj-autoproxy proxy-target-class="true"/>
-
-    <!-- 使用disconf必须添加以下配置 -->
-    <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
-          destroy-method="destroy">
-        <property name="scanPackage" value="com.example.disconf"/>
-    </bean>
-    <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
-          init-method="init" destroy-method="destroy">
-    </bean>
-</beans>

+ 0 - 58
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/logback.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration>
-
-    <statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
-
-    <jmxConfigurator/>
-
-    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <property name="log.base" value="./log/disconf-demo"/>
-    <appender name="logfile"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <File>${log.base}.log</File>
-        <rollingPolicy
-                class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <FileNamePattern>${log.base}.%d{yyyy-MM-dd}.log
-            </FileNamePattern>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <logger name="com.baidu.disconf">
-        <level value="DEBUG"/>
-    </logger>
-
-    <logger name="com.example.disconf">
-        <level value="INFO"/>
-        <appender-ref ref="logfile"/>
-    </logger>
-
-    <logger name="org.springframework">
-        <level value="WARN"/>
-    </logger>
-
-    <logger name="net.sf.ehcache">
-        <level value="ERROR"/>
-    </logger>
-
-    <logger name="org.springmodules">
-        <level value="ERROR"/>
-    </logger>
-
-    <root level="INFO">
-        <appender-ref ref="stdout"/>
-        <appender-ref ref="logfile"/>
-    </root>
-
-</configuration>
-

+ 0 - 2
disconf-demos/disconf-spring-boot-demo/disconf-spring-boot-web/src/main/resources/simple.properties

@@ -1,2 +0,0 @@
-host=127.0.0.1
-port=6379

+ 0 - 26
disconf-demos/disconf-spring-boot-demo/pom.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>com.baidu.disconf</groupId>
-    <artifactId>disconf-spring-boot-demo</artifactId>
-    <packaging>pom</packaging>
-    <version>1.0.0</version>
-    <modules>
-        <module>disconf-spring-boot-core</module>
-        <module>disconf-spring-boot-web</module>
-    </modules>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.1.7.RELEASE</version>
-    </parent>
-
-</project>

+ 0 - 12
disconf-demos/disconf-standalone-demo/.gitignore

@@ -1,12 +0,0 @@
-/target
-/.settings
-/bin
-/.classpath
-/.project
-/target
-/disconf
-/log
-/pom.xml.releaseBackup
-/*.iml
-/.DS_Store
-.idea

+ 0 - 4
disconf-demos/disconf-standalone-demo/README.md

@@ -1,4 +0,0 @@
-disconf-standalone-demo
-=======
-
-使用disconf的standalone demo程序(基于spring)

+ 0 - 1
disconf-demos/disconf-standalone-demo/conffiles/autoconfig.properties

@@ -1 +0,0 @@
-auto=bbd

+ 0 - 1
disconf-demos/disconf-standalone-demo/conffiles/autoconfig2.properties

@@ -1 +0,0 @@
-auto2=cc

+ 0 - 1
disconf-demos/disconf-standalone-demo/conffiles/code.properties

@@ -1 +0,0 @@
-syserror.paramtype=\u8bf7\u6c42\u53c2\u6570\u89e3\u6790\u9519" + "\u8bef

+ 0 - 2
disconf-demos/disconf-standalone-demo/conffiles/coefficients.properties

@@ -1,2 +0,0 @@
-coe.baiFaCoe=1.3
-coe.yuErBaoCoe=1.3

+ 0 - 2
disconf-demos/disconf-standalone-demo/conffiles/empty.properties

@@ -1,2 +0,0 @@
-redis.host=127.0.0.1
-redis.port=8310

+ 0 - 2
disconf-demos/disconf-standalone-demo/conffiles/myserver.properties

@@ -1,2 +0,0 @@
-server=127.0.0.1:16600,127.0.0.1:16602,127.0.0.1:16603
-retry=5

+ 0 - 3
disconf-demos/disconf-standalone-demo/conffiles/myserver_slave.properties

@@ -1,3 +0,0 @@
-#online
-server=127.0.0.1:16700,127.0.0.1:16700,127.0.0.1:16700,127.0.0.1:16700
-retry=3

+ 0 - 2
disconf-demos/disconf-standalone-demo/conffiles/redis.properties

@@ -1,2 +0,0 @@
-redis.host=127.0.0.1
-redis.port=6379

+ 0 - 2
disconf-demos/disconf-standalone-demo/conffiles/remote.properties

@@ -1,2 +0,0 @@
-remoteHost=127.0.0.1
-remotePort=8081

+ 0 - 1
disconf-demos/disconf-standalone-demo/conffiles/static.properties

@@ -1 +0,0 @@
-staticVar=147

+ 0 - 1
disconf-demos/disconf-standalone-demo/conffiles/testJson.json

@@ -1 +0,0 @@
-{"message": {}, "success": "true"}

+ 0 - 10
disconf-demos/disconf-standalone-demo/conffiles/testXml.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<routes>
-    <route sourceHost="*" sourcePort="*"
-        proxyHost="127.0.0.1" proxyPort="8081">
-        <rule>
-            <from method="get">/tradeMap</from>
-            <to method="get">/tradeMap</to>
-        </rule>
-    </route>
-</routes>

+ 0 - 10
disconf-demos/disconf-standalone-demo/conffiles/testXml2.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<routes>
-    <route sourceHost="*" sourcePort="*"
-        proxyHost="127.0.0.1" proxyPort="8081">
-        <rule>
-            <from method="get">/tradeMap</from>
-            <to method="get">/tradeMap</to>
-        </rule>
-    </route>
-</routes>

+ 0 - 25
disconf-demos/disconf-standalone-demo/deploy/package-jar.xml

@@ -1,25 +0,0 @@
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
-    <id>package</id>
-
-    <formats>
-        <format>jar</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-        <fileSet>
-            <directory>target/classes</directory>
-            <excludes>
-                <exclude>disconf.properties</exclude>
-                <exclude>logback.xml</exclude>
-            </excludes>
-            <outputDirectory>/</outputDirectory>
-        </fileSet>
-    </fileSets>
-
-</assembly>

+ 0 - 39
disconf-demos/disconf-standalone-demo/deploy/package-tar.gz.xml

@@ -1,39 +0,0 @@
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
-    <id>package</id>
-
-    <formats>
-        <format>tar.gz</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-
-        <fileSet>
-            <directory>target</directory>
-            <includes>
-                <include>disconf-client.jar</include>
-            </includes>
-            <outputDirectory>lib</outputDirectory>
-        </fileSet>
-
-    </fileSets>
-
-    <dependencySets>
-        <dependencySet>
-            <scope>compile</scope>
-            <outputDirectory>lib</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-        </dependencySet>
-        <dependencySet>
-            <scope>provided</scope>
-            <outputDirectory>lib</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-        </dependencySet>
-    </dependencySets>
-
-</assembly>

+ 0 - 218
disconf-demos/disconf-standalone-demo/pom.xml

@@ -1,218 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>com.baidu.disconf</groupId>
-    <artifactId>disconf-standalone-demo</artifactId>
-    <version>2.0.0</version>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>com.baidu.disconf</groupId>
-            <artifactId>disconf-client</artifactId>
-            <version>2.6.28-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.reflections</groupId>
-            <artifactId>reflections</artifactId>
-            <version>0.9.9-RC1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-            <version>3.3.6</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jmx</groupId>
-                    <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jdmk</groupId>
-                    <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.jms</groupId>
-                    <artifactId>jms</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>1.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>1.0.4</version>
-
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.6</version>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-core</artifactId>
-            <version>1.0.9</version>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.0.9</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>4.2.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>2.0-rc1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.8.1</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>redis.clients</groupId>
-            <artifactId>jedis</artifactId>
-            <version>2.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-            <version>3.1.2.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>dubbo</artifactId>
-            <version>2.5.3</version>
-        </dependency>
-        <dependency>
-            <groupId>com.101tec</groupId>
-            <artifactId>zkclient</artifactId>
-            <version>0.4</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-
-        <defaultGoal>package</defaultGoal>
-        <finalName>${project.artifactId}</finalName>
-        <outputDirectory>target/classes</outputDirectory>
-
-        <resources>
-            <resource>
-                <directory>${project.basedir}/src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </resource>
-            <resource>
-                <directory>${project.basedir}/src/main/resources</directory>
-                <includes>
-                    <include>*.*</include>
-                </includes>
-            </resource>
-        </resources>
-
-        <plugins>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.1</version>
-                <configuration>
-                    <failOnError>true</failOnError>
-                    <showDeprecation>true</showDeprecation>
-                    <showWarnings>true</showWarnings>
-                    <compilerArguments>
-                        <verbose/>
-                        <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
-                    </compilerArguments>
-                </configuration>
-
-                <dependencies>
-                    <dependency>
-                        <groupId>org.codehaus.plexus</groupId>
-                        <artifactId>plexus-compiler-javac</artifactId>
-                        <version>1.8.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.4</version>
-                <configuration>
-                    <excludes>
-                        <exclude>*.properties</exclude>
-                        <exclude>**/*.properties</exclude>
-                        <exclude>conf/**</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.3</version>
-                <executions>
-
-                    <execution>
-                        <id>make-jar</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <descriptors>
-                                <descriptor>deploy/package-jar.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-
-                    <execution>
-                        <id>make-tar.gz</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <descriptors>
-                                <descriptor>deploy/package-tar.gz.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 40
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/DisconfDemoMain.java

@@ -1,40 +0,0 @@
-package com.example.disconf.demo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import com.example.disconf.demo.task.DisconfDemoTask;
-
-/**
- * @author liaoqiqi
- * @version 2014-6-17
- */
-public class DisconfDemoMain {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfDemoMain.class);
-
-    private static String[] fn = null;
-
-    // 初始化spring文档
-    private static void contextInitialized() {
-        fn = new String[] {"applicationContext.xml"};
-    }
-
-    /**
-     * @param args
-     *
-     * @throws Exception
-     */
-    public static void main(String[] args) throws Exception {
-
-        contextInitialized();
-        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(fn);
-
-        DisconfDemoTask task = (DisconfDemoTask) ctx.getBean("disconfDemoTask", DisconfDemoTask.class);
-
-        int ret = task.run();
-
-        System.exit(ret);
-    }
-}

+ 0 - 25
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/CodeConfig.java

@@ -1,25 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * Created by knightliao on 15/1/7.
- */
-@Service
-@DisconfFile(filename = "code.properties", copy2TargetDirPath = "disconf")
-public class CodeConfig {
-
-    private String codeError = "";
-
-    @DisconfFileItem(name = "syserror.paramtype", associateField = "codeError")
-    public String getCodeError() {
-        return codeError;
-    }
-
-    public void setCodeError(String codeError) {
-        this.codeError = codeError;
-    }
-}

+ 0 - 67
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/Coefficients.java

@@ -1,67 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-
-/**
- * 金融系数文件
- */
-@Service
-@DisconfFile(filename = "coefficients.properties")
-public class Coefficients {
-
-    public static final String key = "discountRate";
-
-    @Value(value = "2.0d")
-    private Double discount;
-
-    private double baiFaCoe;
-
-    private double yuErBaoCoe;
-
-    /**
-     * 阿里余额宝的系数, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "coe.baiFaCoe")
-    public double getBaiFaCoe() {
-        return baiFaCoe;
-    }
-
-    public void setBaiFaCoe(double baiFaCoe) {
-        this.baiFaCoe = baiFaCoe;
-    }
-
-    /**
-     * 百发的系数, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "coe.yuErBaoCoe")
-    public double getYuErBaoCoe() {
-        return yuErBaoCoe;
-    }
-
-    public void setYuErBaoCoe(double yuErBaoCoe) {
-        this.yuErBaoCoe = yuErBaoCoe;
-    }
-
-    /**
-     * 折扣率,分布式配置
-     *
-     * @return
-     */
-    @DisconfItem(key = key)
-    public Double getDiscount() {
-        return discount;
-    }
-
-    public void setDiscount(Double discount) {
-        this.discount = discount;
-    }
-}

+ 0 - 16
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/EmptyConf.java

@@ -1,16 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-
-/**
- * 空的分布式配置文件,用途有两种:<br/>
- * 1. 对配置文件里的内容不感兴趣,只是单纯的下载<br/>
- * 2. 当配置文件更新时,可以自动下载到本地
- */
-@Service
-@DisconfFile(filename = "empty.properties")
-public class EmptyConf {
-
-}

+ 0 - 65
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/JedisConfig.java

@@ -1,65 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-
-/**
- * Redis配置文件
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-@DisconfFile(filename = "redis.properties")
-@DisconfUpdateService(classes = {JedisConfig.class})
-public class JedisConfig implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(JedisConfig.class);
-
-    // 代表连接地址
-    private String host;
-
-    // 代表连接port
-    private int port;
-
-    /**
-     * 地址, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "redis.host", associateField = "host")
-    public String getHost() {
-        return host;
-    }
-
-    public void setHost(String host) {
-        this.host = host;
-    }
-
-    /**
-     * 端口, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "redis.port", associateField = "port")
-    public int getPort() {
-        return port;
-    }
-
-    public void setPort(int port) {
-        this.port = port;
-    }
-
-    @Override
-    public void reload() throws Exception {
-        LOGGER.info("host: " + host);
-    }
-}

+ 0 - 50
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/RemoteServerConfig.java

@@ -1,50 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@DisconfFile(filename = "remote.properties")
-public class RemoteServerConfig {
-
-    // 代表连接地址
-    private String remoteHost;
-
-    // 代表连接port
-    private int remotePort = 8080;
-
-    /**
-     * 地址, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "remoteHost")
-    public String getRemoteHost() {
-        return remoteHost;
-    }
-
-    public void setRemoteHost(String remoteHost) {
-        this.remoteHost = remoteHost;
-    }
-
-    /**
-     * 端口, 分布式文件配置
-     *
-     * @return
-     */
-    @DisconfFileItem(name = "remotePort")
-    public int getRemotePort() {
-        return remotePort;
-    }
-
-    public void setRemotePort(int remotePort) {
-        this.remotePort = remotePort;
-    }
-
-}

+ 0 - 26
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/StaticConfig.java

@@ -1,26 +0,0 @@
-package com.example.disconf.demo.config;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * 静态 配置文件 示例
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@DisconfFile(filename = "static.properties")
-public class StaticConfig {
-
-    private static int staticVar;
-
-    @DisconfFileItem(name = "staticVar", associateField = "staticVar")
-    public static int getStaticVar() {
-        return staticVar;
-    }
-
-    public static void setStaticVar(int staticVar) {
-        StaticConfig.staticVar = staticVar;
-    }
-
-}

+ 0 - 16
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/config/TestXmlConfig.java

@@ -1,16 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-
-/**
- * 空的分布式配置文件,用途有两种:<br/>
- * 1. 对配置文件里的内容不感兴趣,只是单纯的下载<br/>
- * 2. 当配置文件更新时,可以自动下载到本地
- */
-@Service
-@DisconfFile(filename = "testXml.xml")
-public class TestXmlConfig {
-
-}

+ 0 - 17
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/AutoService.java

@@ -1,17 +0,0 @@
-package com.example.disconf.demo.service;
-
-/**
- * Created by knightliao on 15/3/19.
- */
-public class AutoService {
-
-    private String auto;
-
-    public String getAuto() {
-        return auto;
-    }
-
-    public void setAuto(String auto) {
-        this.auto = auto;
-    }
-}

+ 0 - 17
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/AutoService2.java

@@ -1,17 +0,0 @@
-package com.example.disconf.demo.service;
-
-/**
- * Created by knightliao on 15/3/19.
- */
-public class AutoService2 {
-
-    private String auto2;
-
-    public String getAuto2() {
-        return auto2;
-    }
-
-    public void setAuto2(String auto2) {
-        this.auto2 = auto2;
-    }
-}

+ 0 - 66
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/BaoBaoService.java

@@ -1,66 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-import com.example.disconf.demo.config.Coefficients;
-
-/**
- * 金融宝服务,计算一天赚多少钱
- *
- * @author liaoqiqi
- * @version 2014-5-16
- */
-@Service
-public class BaoBaoService {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(BaoBaoService.class);
-
-    public static final String key = "moneyInvest";
-
-    @Value(value = "2000d")
-    private Double moneyInvest;
-
-    @Autowired
-    private Coefficients coefficients;
-
-    /**
-     * 计算百发一天赚多少钱
-     *
-     * @return
-     */
-    public double calcBaiFa() {
-        return coefficients.getBaiFaCoe() * coefficients.getDiscount() * getMoneyInvest();
-    }
-
-    /**
-     * k 计算余额宝一天赚多少钱
-     *
-     * @return
-     */
-    public double calcYuErBao() {
-        return coefficients.getYuErBaoCoe() * coefficients.getDiscount() * getMoneyInvest();
-    }
-
-    /**
-     * 投资的钱,分布式配置 <br/>
-     * <br/>
-     * 这里切面无法生效,因为SpringAOP不支持。<br/>
-     * 但是这里还是正确的,因为我们会将值注入到Bean的值里.
-     *
-     * @return
-     */
-    @DisconfItem(key = key)
-    public Double getMoneyInvest() {
-        return moneyInvest;
-    }
-
-    public void setMoneyInvest(Double moneyInvest) {
-        this.moneyInvest = moneyInvest;
-    }
-
-}

+ 0 - 54
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/RemoteService.java

@@ -1,54 +0,0 @@
-package com.example.disconf.demo.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.disconf.demo.config.RemoteServerConfig;
-
-/**
- * 一个未知远程服务, 这里也不使用注解的 @Service
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-public class RemoteService implements InitializingBean, DisposableBean {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(RemoteService.class);
-
-    private List<String> list = new ArrayList<String>();
-
-    @Autowired
-    private RemoteServerConfig remoteServerConfig;
-
-    public void destroy() throws Exception {
-
-    }
-
-    public void afterPropertiesSet() throws Exception {
-
-        list.add(remoteServerConfig.getRemoteHost());
-        list.add(String.valueOf(remoteServerConfig.getRemoteHost()));
-    }
-
-    /**
-     * 更改Jedis
-     */
-    public void reload() {
-
-        LOGGER.info("start to reload remote service to: " + remoteServerConfig.getRemoteHost() + " : " +
-                        remoteServerConfig.getRemoteHost());
-
-        list.add(remoteServerConfig.getRemoteHost());
-        list.add(String.valueOf(remoteServerConfig.getRemoteHost()));
-
-        LOGGER.info("reload ok.");
-    }
-}

+ 0 - 81
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisService.java

@@ -1,81 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.example.disconf.demo.config.JedisConfig;
-import com.example.disconf.demo.utils.JedisUtil;
-
-import redis.clients.jedis.Jedis;
-
-/**
- * 一个简单的Redis服务
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-public class SimpleRedisService implements InitializingBean, DisposableBean {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRedisService.class);
-
-    // jedis 实例
-    private Jedis jedis = null;
-
-    /**
-     * 分布式配置
-     */
-    @Autowired
-    private JedisConfig jedisConfig;
-
-    /**
-     * 关闭
-     */
-    public void destroy() throws Exception {
-
-        if (jedis != null) {
-            jedis.disconnect();
-        }
-    }
-
-    /**
-     * 进行连接
-     */
-    public void afterPropertiesSet() throws Exception {
-
-        jedis = JedisUtil.createJedis(jedisConfig.getHost(), jedisConfig.getPort());
-    }
-
-    /**
-     * 获取一个值
-     *
-     * @param key
-     *
-     * @return
-     */
-    public String getKey(String key) {
-        if (jedis != null) {
-            return jedis.get(key);
-        }
-
-        return null;
-    }
-
-    /**
-     * 更改Jedis
-     */
-    public void changeJedis() {
-
-        LOGGER.info("start to change jedis hosts to: " + jedisConfig.getHost() + " : " + jedisConfig.getPort());
-
-        jedis = JedisUtil.createJedis(jedisConfig.getHost(), jedisConfig.getPort());
-
-        LOGGER.info("change ok.");
-    }
-}

+ 0 - 34
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/SimpleStaticService.java

@@ -1,34 +0,0 @@
-package com.example.disconf.demo.service;
-
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-import com.example.disconf.demo.config.StaticConfig;
-
-/**
- * 使用静态配置文件的示例<br/>
- * Plus <br/>
- * 静态配置项 使用示例
- *
- * @author liaoqiqi
- * @version 2014-8-14
- */
-public class SimpleStaticService {
-
-    private static int staticItem = 56;
-
-    /**
-     * @return
-     */
-    public static int getStaticFileData() {
-
-        return StaticConfig.getStaticVar();
-    }
-
-    @DisconfItem(key = "staticItem")
-    public static int getStaticItem() {
-        return staticItem;
-    }
-
-    public static void setStaticItem(int staticItem) {
-        SimpleStaticService.staticItem = staticItem;
-    }
-}

+ 0 - 32
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/AutoServiceCallback.java

@@ -1,32 +0,0 @@
-package com.example.disconf.demo.service.callbacks;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.service.AutoService;
-
-/**
- * 这是 autoconfig.properties 的回调函数类
- * <p/>
- * Created by knightliao on 15/3/21.
- */
-@Service
-@DisconfUpdateService(confFileKeys = {"autoconfig.properties", "autoconfig2.properties"})
-public class AutoServiceCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(AutoServiceCallback.class);
-
-    @Autowired
-    private AutoService autoService;
-
-    @Override
-    public void reload() throws Exception {
-
-        LOGGER.info("reload callback " + "autoconfig.properties or autoconfig2.properties" + autoService.getAuto());
-
-    }
-}

+ 0 - 36
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/RemoteServiceUpdateCallback.java

@@ -1,36 +0,0 @@
-package com.example.disconf.demo.service.callbacks;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.config.RemoteServerConfig;
-import com.example.disconf.demo.service.RemoteService;
-
-/**
- * 这是RemoteService的回调函数类
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@DisconfUpdateService(classes = {RemoteServerConfig.class})
-public class RemoteServiceUpdateCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(RemoteServiceUpdateCallback.class);
-
-    @Autowired
-    private RemoteService remoteService;
-
-    /**
-     *
-     */
-    public void reload() throws Exception {
-
-        remoteService.reload();
-    }
-
-}

+ 0 - 39
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/SimpleRedisServiceUpdateCallback.java

@@ -1,39 +0,0 @@
-package com.example.disconf.demo.service.callbacks;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.config.Coefficients;
-import com.example.disconf.demo.config.JedisConfig;
-import com.example.disconf.demo.service.SimpleRedisService;
-
-/**
- * 更新Redis配置时的回调函数
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-@DisconfUpdateService(classes = {JedisConfig.class}, itemKeys = {Coefficients.key})
-public class SimpleRedisServiceUpdateCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRedisServiceUpdateCallback.class);
-
-    @Autowired
-    private SimpleRedisService simpleRedisService;
-
-    /**
-     *
-     */
-    public void reload() throws Exception {
-
-        simpleRedisService.changeJedis();
-    }
-
-}

+ 0 - 17
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/TestJsonConfigCallback.java

@@ -1,17 +0,0 @@
-package com.example.disconf.demo.service.callbacks;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-
-@Service
-@DisconfUpdateService(confFileKeys = {"testJson.json"})
-public class TestJsonConfigCallback implements IDisconfUpdate {
-
-    public void reload() throws Exception {
-
-        System.out.println("now i'm at xml update callback ");
-    }
-
-}

+ 0 - 18
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/service/callbacks/TestXmlConfigCallback.java

@@ -1,18 +0,0 @@
-package com.example.disconf.demo.service.callbacks;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.config.TestXmlConfig;
-
-/**
- * 如果你的回调类里没有 进行autowired ,那么你的回调类可以是非 spring托管的
- */
-@DisconfUpdateService(classes = {TestXmlConfig.class}, confFileKeys = {"testJson.json"})
-public class TestXmlConfigCallback implements IDisconfUpdate {
-
-    public void reload() throws Exception {
-
-        System.out.println("now i'm at xml update callback ");
-    }
-
-}

+ 0 - 100
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/task/DisconfDemoTask.java

@@ -1,100 +0,0 @@
-package com.example.disconf.demo.task;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.disconf.demo.config.CodeConfig;
-import com.example.disconf.demo.config.JedisConfig;
-import com.example.disconf.demo.service.AutoService;
-import com.example.disconf.demo.service.AutoService2;
-import com.example.disconf.demo.service.BaoBaoService;
-import com.example.disconf.demo.service.SimpleRedisService;
-import com.example.disconf.demo.service.SimpleStaticService;
-
-/**
- * 演示分布式配置文件、分布式配置的更新Demo
- *
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-public class DisconfDemoTask {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfDemoTask.class);
-
-    @Autowired
-    private BaoBaoService baoBaoService;
-
-    @Autowired
-    private SimpleRedisService simpleRedisService;
-
-    @Autowired
-    private JedisConfig jedisConfig;
-
-    @Autowired
-    private AutoService autoService;
-
-    @Autowired
-    private AutoService2 autoService2;
-
-    @Autowired
-    private CodeConfig codeConfig;
-
-    private static final String REDIS_KEY = "disconf_key";
-
-    /**
-     *
-     */
-    public int run() {
-
-        try {
-
-            while (true) {
-
-                //
-                // service demo
-                //
-
-                LOGGER.info("baobao--baifa: " + baoBaoService.calcBaiFa());
-                LOGGER.info("baobao--yuerbao: " + baoBaoService.calcYuErBao());
-
-                Thread.sleep(5000);
-
-                LOGGER.info("redis( " + jedisConfig.getHost() + "," + jedisConfig.getPort() + ")  get " +
-                                "key: " + REDIS_KEY +
-                                " , "
-                        // + simpleRedisService.getKey(REDIS_KEY)
-                );
-
-                LOGGER.info("redis( " + jedisConfig.getHost() + "," + jedisConfig.getPort() + ")");
-
-                LOGGER.info("code config: " + codeConfig.getCodeError());
-
-                //
-                // xml demo
-                //
-
-                LOGGER.info("autoservice: " + autoService.getAuto());
-
-                LOGGER.info("autoservice2: " + autoService2.getAuto2());
-
-                //
-                // static config demo
-                //
-
-                LOGGER.info("static file data:" + SimpleStaticService.getStaticFileData());
-
-                LOGGER.info("static item data:" + SimpleStaticService.getStaticItem());
-
-            }
-
-        } catch (Exception e) {
-
-            LOGGER.error(e.toString(), e);
-        }
-
-        return 0;
-    }
-}

+ 0 - 33
disconf-demos/disconf-standalone-demo/src/main/java/com/example/disconf/demo/utils/JedisUtil.java

@@ -1,33 +0,0 @@
-package com.example.disconf.demo.utils;
-
-import org.apache.commons.lang.StringUtils;
-
-import redis.clients.jedis.Jedis;
-
-/**
- * @author liaoqiqi
- * @version 2014-6-17
- */
-public class JedisUtil {
-
-    public static Jedis createJedis() {
-        Jedis jedis = new Jedis("127.0.0.1");
-        return jedis;
-    }
-
-    public static Jedis createJedis(String host, int port) {
-        Jedis jedis = new Jedis(host, port);
-
-        return jedis;
-    }
-
-    public static Jedis createJedis(String host, int port, String password) {
-        Jedis jedis = new Jedis(host, port);
-
-        if (!StringUtils.isNotBlank(password)) {
-            jedis.auth(password);
-        }
-
-        return jedis;
-    }
-}

+ 0 - 80
disconf-demos/disconf-standalone-demo/src/main/resources/applicationContext.xml

@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-        http://www.springframework.org/schema/aop 
-        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-        http://www.springframework.org/schema/context 
-        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-    <context:component-scan base-package="com.baidu,com.example"/>
-
-    <aop:aspectj-autoproxy proxy-target-class="true"/>
-
-    <!-- 使用disconf必须添加以下配置 -->
-    <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
-          destroy-method="destroy">
-        <property name="scanPackage" value="com.example.disconf.demo"/>
-    </bean>
-    <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
-          init-method="init" destroy-method="destroy">
-    </bean>
-
-    <!-- 使用托管方式的disconf配置(无代码侵入, 配置更改会自动reload)-->
-    <bean id="configproperties_disconf"
-          class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">
-        <property name="locations">
-            <list>
-                <value>classpath:/autoconfig.properties</value>
-                <value>classpath:/autoconfig2.properties</value>
-                <value>classpath:/myserver_slave.properties</value>
-                <value>classpath:/testJson.json</value>
-                <value>testXml2.xml</value>
-            </list>
-        </property>
-    </bean>
-
-    <bean id="propertyConfigurer"
-          class="com.baidu.disconf.client.addons.properties.ReloadingPropertyPlaceholderConfigurer">
-        <property name="ignoreResourceNotFound" value="true"/>
-        <property name="ignoreUnresolvablePlaceholders" value="true"/>
-        <property name="propertiesArray">
-            <list>
-                <ref bean="configproperties_disconf"/>
-            </list>
-        </property>
-    </bean>
-
-    <!-- 使用托管方式的disconf配置(无代码侵入, 配置更改不会自动reload)-->
-    <bean id="configproperties_no_reloadable_disconf"
-          class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">
-        <property name="locations">
-            <list>
-                <value>myserver.properties</value>
-            </list>
-        </property>
-    </bean>
-
-    <bean id="propertyConfigurerForProject1"
-          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-        <property name="ignoreResourceNotFound" value="true"/>
-        <property name="ignoreUnresolvablePlaceholders" value="true"/>
-        <property name="propertiesArray">
-            <list>
-                <ref bean="configproperties_no_reloadable_disconf"/>
-            </list>
-        </property>
-    </bean>
-
-    <bean id="autoService" class="com.example.disconf.demo.service.AutoService">
-        <property name="auto" value="${auto=100}"/>
-    </bean>
-
-    <bean id="autoService2" class="com.example.disconf.demo.service.AutoService2">
-        <property name="auto2" value="${auto2}"/>
-    </bean>
-
-</beans>

+ 0 - 30
disconf-demos/disconf-standalone-demo/src/main/resources/disconf.properties

@@ -1,30 +0,0 @@
-
-
-# \u662F\u5426\u4F7F\u7528\u8FDC\u7A0B\u914D\u7F6E\u6587\u4EF6
-# true(\u9ED8\u8BA4)\u4F1A\u4ECE\u8FDC\u7A0B\u83B7\u53D6\u914D\u7F6E false\u5219\u76F4\u63A5\u83B7\u53D6\u672C\u5730\u914D\u7F6E
-disconf.enable.remote.conf=true
-
-#
-# \u914D\u7F6E\u670D\u52A1\u5668\u7684 HOST,\u7528\u9017\u53F7\u5206\u9694  127.0.0.1:8000,127.0.0.1:8000
-#
-disconf.conf_server_host=127.0.0.1:8080
-
-# \u7248\u672C, \u8BF7\u91C7\u7528 X_X_X_X \u683C\u5F0F 
-disconf.version=1_0_0_0
-
-# APP \u8BF7\u91C7\u7528 \u4EA7\u54C1\u7EBF_\u670D\u52A1\u540D \u683C\u5F0F 
-disconf.app=disconf_demo
-
-# \u73AF\u5883
-disconf.env=rd
-
-# \u5FFD\u7565\u54EA\u4E9B\u5206\u5E03\u5F0F\u914D\u7F6E\uFF0C\u7528\u9017\u53F7\u5206\u9694
-disconf.ignore=
-
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u6B21\u6570\uFF0C\u9ED8\u8BA4\u662F3\u6B21
-disconf.conf_server_url_retry_times=1
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u65F6\u4F11\u7720\u65F6\u95F4\uFF0C\u9ED8\u8BA4\u662F5\u79D2
-disconf.conf_server_url_retry_sleep_seconds=1
-
-# \u7528\u6237\u6307\u5B9A\u7684\u4E0B\u8F7D\u6587\u4EF6\u5939, \u8FDC\u7A0B\u6587\u4EF6\u4E0B\u8F7D\u540E\u4F1A\u653E\u5728\u8FD9\u91CC
-disconf.user_define_download_dir=./disconf/download2

+ 0 - 58
disconf-demos/disconf-standalone-demo/src/main/resources/logback.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration>
-
-    <statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
-
-    <jmxConfigurator/>
-
-    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <property name="log.base" value="./log/disconf-demo"/>
-    <appender name="logfile"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <File>${log.base}.log</File>
-        <rollingPolicy
-                class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <FileNamePattern>${log.base}.%d{yyyy-MM-dd}.log
-            </FileNamePattern>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <logger name="com.baidu.disconf">
-        <level value="DEBUG"/>
-    </logger>
-
-    <logger name="com.baidu.disconf.demo">
-        <level value="INFO"/>
-        <appender-ref ref="logfile"/>
-    </logger>
-
-    <logger name="org.springframework">
-        <level value="WARN"/>
-    </logger>
-
-    <logger name="net.sf.ehcache">
-        <level value="ERROR"/>
-    </logger>
-
-    <logger name="org.springmodules">
-        <level value="ERROR"/>
-    </logger>
-
-    <root level="INFO">
-        <appender-ref ref="stdout"/>
-        <appender-ref ref="logfile"/>
-    </root>
-
-</configuration>
-

+ 0 - 10
disconf-demos/disconf-standalone-dubbo-demo/.gitignore

@@ -1,10 +0,0 @@
-/.settings
-/target
-/.classpath
-/.project
-/.DS_Store
-/disconf
-/log
-/bin
-/disconf-standalone-dubbo-demo.iml
-.idea

+ 0 - 4
disconf-demos/disconf-standalone-dubbo-demo/README.md

@@ -1,4 +0,0 @@
-
-鉴于现在 SOA服务治理 dubbo 的流行化,此demo演示和 disconf 和 dubbo 的集成 demo. 
-
-- using dubbo 2.5.3 

+ 0 - 25
disconf-demos/disconf-standalone-dubbo-demo/deploy/package-jar.xml

@@ -1,25 +0,0 @@
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
-    <id>package</id>
-
-    <formats>
-        <format>jar</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-        <fileSet>
-            <directory>target/classes</directory>
-            <excludes>
-                <exclude>disconf.properties</exclude>
-                <exclude>logback.xml</exclude>
-            </excludes>
-            <outputDirectory>/</outputDirectory>
-        </fileSet>
-    </fileSets>
-
-</assembly>

+ 0 - 39
disconf-demos/disconf-standalone-dubbo-demo/deploy/package-tar.gz.xml

@@ -1,39 +0,0 @@
-<assembly
-    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
-    <id>package</id>
-
-    <formats>
-        <format>tar.gz</format>
-    </formats>
-
-    <includeBaseDirectory>false</includeBaseDirectory>
-
-    <fileSets>
-
-        <fileSet>
-            <directory>target</directory>
-            <includes>
-                <include>disconf-client.jar</include>
-            </includes>
-            <outputDirectory>lib</outputDirectory>
-        </fileSet>
-
-    </fileSets>
-
-    <dependencySets>
-        <dependencySet>
-            <scope>compile</scope>
-            <outputDirectory>lib</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-        </dependencySet>
-        <dependencySet>
-            <scope>provided</scope>
-            <outputDirectory>lib</outputDirectory>
-            <useProjectArtifact>false</useProjectArtifact>
-        </dependencySet>
-    </dependencySets>
-
-</assembly>

+ 0 - 219
disconf-demos/disconf-standalone-dubbo-demo/pom.xml

@@ -1,219 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>com.baidu.disconf</groupId>
-    <artifactId>disconf-standalone-dubbo-demo</artifactId>
-    <version>2.0.0</version>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>com.baidu.disconf</groupId>
-            <artifactId>disconf-client</artifactId>
-            <version>2.6.28-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.reflections</groupId>
-            <artifactId>reflections</artifactId>
-            <version>0.9.9-RC1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-            <version>3.3.6</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jmx</groupId>
-                    <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jdmk</groupId>
-                    <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.jms</groupId>
-                    <artifactId>jms</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>1.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>1.0.4</version>
-
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.6</version>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-core</artifactId>
-            <version>1.0.9</version>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.0.9</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>4.2.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>2.0-rc1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.8.1</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>redis.clients</groupId>
-            <artifactId>jedis</artifactId>
-            <version>2.1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-            <version>3.1.2.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>dubbo</artifactId>
-            <version>2.5.3</version>
-        </dependency>
-        <dependency>
-            <groupId>com.101tec</groupId>
-            <artifactId>zkclient</artifactId>
-            <version>0.4</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-
-        <defaultGoal>package</defaultGoal>
-        <finalName>${project.artifactId}</finalName>
-        <outputDirectory>target/classes</outputDirectory>
-
-        <resources>
-            <resource>
-                <directory>${project.basedir}/src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </resource>
-            <resource>
-                <directory>${project.basedir}/src/main/resources</directory>
-                <includes>
-                    <include>*.*</include>
-                </includes>
-            </resource>
-        </resources>
-
-        <plugins>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.1</version>
-                <configuration>
-                    <failOnError>true</failOnError>
-                    <showDeprecation>true</showDeprecation>
-                    <showWarnings>true</showWarnings>
-                    <compilerArguments>
-                        <verbose/>
-                        <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
-                    </compilerArguments>
-                </configuration>
-
-                <dependencies>
-                    <dependency>
-                        <groupId>org.codehaus.plexus</groupId>
-                        <artifactId>plexus-compiler-javac</artifactId>
-                        <version>1.8.1</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.4</version>
-                <configuration>
-                    <excludes>
-                        <exclude>*.properties</exclude>
-                        <exclude>**/*.properties</exclude>
-                        <exclude>conf/**</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.3</version>
-                <executions>
-
-                    <execution>
-                        <id>make-jar</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <descriptors>
-                                <descriptor>deploy/package-jar.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-
-                    <execution>
-                        <id>make-tar.gz</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                        <configuration>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <descriptors>
-                                <descriptor>deploy/package-tar.gz.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 41
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/DisconfDemoMain.java

@@ -1,41 +0,0 @@
-package com.example.disconf.demo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import com.example.disconf.demo.task.DisconfDemoTask;
-
-/**
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-public class DisconfDemoMain {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfDemoMain.class);
-
-    private static String[] fn = null;
-
-    // 初始化spring文档
-    private static void contextInitialized() {
-        fn = new String[] { "applicationContext.xml" };
-    }
-
-    /***
-     * 
-     * @param args
-     * @throws Exception
-     */
-    public static void main(String[] args) throws Exception {
-
-        contextInitialized();
-        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(fn);
-
-        DisconfDemoTask task = (DisconfDemoTask) ctx.getBean("disconfDemoTask", DisconfDemoTask.class);
-
-        int ret = task.run();
-
-        System.exit(ret);
-    }
-}

+ 0 - 68
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/Coefficients.java

@@ -1,68 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-
-/**
- * 金融系数文件
- * 
- **/
-@Service
-@DisconfFile(filename = "coefficients.properties")
-public class Coefficients {
-
-    public static final String key = "discountRate";
-
-    @Value(value = "2.0d")
-    private Double discount;
-
-    private double baiFaCoe;
-
-    private double yuErBaoCoe;
-
-    /**
-     * 阿里余额宝的系数, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "coe.baiFaCoe")
-    public double getBaiFaCoe() {
-        return baiFaCoe;
-    }
-
-    public void setBaiFaCoe(double baiFaCoe) {
-        this.baiFaCoe = baiFaCoe;
-    }
-
-    /**
-     * 百发的系数, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "coe.yuErBaoCoe")
-    public double getYuErBaoCoe() {
-        return yuErBaoCoe;
-    }
-
-    public void setYuErBaoCoe(double yuErBaoCoe) {
-        this.yuErBaoCoe = yuErBaoCoe;
-    }
-
-    /**
-     * 折扣率,分布式配置
-     * 
-     * @return
-     */
-    @DisconfItem(key = key)
-    public Double getDiscount() {
-        return discount;
-    }
-
-    public void setDiscount(Double discount) {
-        this.discount = discount;
-    }
-}

+ 0 - 17
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/EmptyConf.java

@@ -1,17 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-
-/**
- * 空的分布式配置文件,用途有两种:<br/>
- * 1. 对配置文件里的内容不感兴趣,只是单纯的下载<br/>
- * 2. 当配置文件更新时,可以自动下载到本地
- * 
- **/
-@Service
-@DisconfFile(filename = "empty.properties")
-public class EmptyConf {
-
-}

+ 0 - 53
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/JedisConfig.java

@@ -1,53 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * Redis配置文件
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-@DisconfFile(filename = "redis.properties")
-public class JedisConfig {
-
-    // 代表连接地址
-    private String host;
-
-    // 代表连接port
-    private int port;
-
-    /**
-     * 地址, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "redis.host", associateField = "host")
-    public String getHost() {
-        return host;
-    }
-
-    public void setHost(String host) {
-        this.host = host;
-    }
-
-    /**
-     * 端口, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "redis.port", associateField = "port")
-    public int getPort() {
-        return port;
-    }
-
-    public void setPort(int port) {
-        this.port = port;
-    }
-}

+ 0 - 51
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/RemoteServerConfig.java

@@ -1,51 +0,0 @@
-package com.example.disconf.demo.config;
-
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@DisconfFile(filename = "remote.properties")
-public class RemoteServerConfig {
-
-    // 代表连接地址
-    private String remoteHost;
-
-    // 代表连接port
-    private int remotePort = 8080;
-
-    /**
-     * 地址, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "remoteHost")
-    public String getRemoteHost() {
-        return remoteHost;
-    }
-
-    public void setRemoteHost(String remoteHost) {
-        this.remoteHost = remoteHost;
-    }
-
-    /**
-     * 端口, 分布式文件配置
-     * 
-     * @return
-     */
-    @DisconfFileItem(name = "remotePort")
-    public int getRemotePort() {
-        return remotePort;
-    }
-
-    public void setRemotePort(int remotePort) {
-        this.remotePort = remotePort;
-    }
-
-}

+ 0 - 26
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/config/StaticConfig.java

@@ -1,26 +0,0 @@
-package com.example.disconf.demo.config;
-
-import com.baidu.disconf.client.common.annotations.DisconfFile;
-import com.baidu.disconf.client.common.annotations.DisconfFileItem;
-
-/**
- * 静态 配置文件 示例
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@DisconfFile(filename = "static.properties")
-public class StaticConfig {
-
-    private static int staticVar;
-
-    @DisconfFileItem(name = "staticVar", associateField = "staticVar")
-    public static int getStaticVar() {
-        return staticVar;
-    }
-
-    public static void setStaticVar(int staticVar) {
-        StaticConfig.staticVar = staticVar;
-    }
-
-}

+ 0 - 28
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/consumer/Consumer.java

@@ -1,28 +0,0 @@
-package com.example.disconf.demo.dubbo.consumer;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import com.example.disconf.demo.dubbo.service.DubboService;
-
-public class Consumer {
-
-    public static void main(String[] args) throws Exception {
-
-        ClassPathXmlApplicationContext context =
-                new ClassPathXmlApplicationContext(new String[] { "dubbo-consumer.xml" });
-
-        context.start();
-
-        DubboService demoService = (DubboService) context.getBean("dubboService"); // 获取远程服务代理
-
-        for (int i = 0; i < 100; ++i) {
-
-            String hello = demoService.printWord("Dubbo Client: " + i); // 执行远程方法
-
-            System.out.println(hello); // 显示调用结果
-
-            Thread.sleep(1000);
-        }
-    }
-
-}

+ 0 - 7
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/service/DubboService.java

@@ -1,7 +0,0 @@
-package com.example.disconf.demo.dubbo.service;
-
-public interface DubboService {
-
-    public String printWord(String word);
-
-}

+ 0 - 17
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/dubbo/service/impl/DubboServiceImpl.java

@@ -1,17 +0,0 @@
-package com.example.disconf.demo.dubbo.service.impl;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import com.example.disconf.demo.dubbo.service.DubboService;
-
-public class DubboServiceImpl implements DubboService {
-
-    public String printWord(String word) {
-
-        String outWord = new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss ]").format(new Date()) + word;
-        System.out.println("Dubbo Server: " + outWord);
-        return outWord;
-    }
-
-}

+ 0 - 66
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/BaoBaoService.java

@@ -1,66 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-import com.example.disconf.demo.config.Coefficients;
-
-/**
- * 金融宝服务,计算一天赚多少钱
- * 
- * @author liaoqiqi
- * @version 2014-5-16
- */
-@Service
-public class BaoBaoService {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(BaoBaoService.class);
-
-    public static final String key = "moneyInvest";
-
-    @Value(value = "2000d")
-    private Double moneyInvest;
-
-    @Autowired
-    private Coefficients coefficients;
-
-    /**
-     * 计算百发一天赚多少钱
-     * 
-     * @return
-     */
-    public double calcBaiFa() {
-        return coefficients.getBaiFaCoe() * coefficients.getDiscount() * getMoneyInvest();
-    }
-
-    /**
-     * k 计算余额宝一天赚多少钱
-     * 
-     * @return
-     */
-    public double calcYuErBao() {
-        return coefficients.getYuErBaoCoe() * coefficients.getDiscount() * getMoneyInvest();
-    }
-
-    /**
-     * 投资的钱,分布式配置 <br/>
-     * <br/>
-     * 这里切面无法生效,因为SpringAOP不支持。<br/>
-     * 但是这里还是正确的,因为我们会将值注入到Bean的值里.
-     * 
-     * @return
-     */
-    @DisconfItem(key = key)
-    public Double getMoneyInvest() {
-        return moneyInvest;
-    }
-
-    public void setMoneyInvest(Double moneyInvest) {
-        this.moneyInvest = moneyInvest;
-    }
-
-}

+ 0 - 54
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/RemoteService.java

@@ -1,54 +0,0 @@
-package com.example.disconf.demo.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.disconf.demo.config.RemoteServerConfig;
-
-/**
- * 一个未知远程服务, 这里也不使用注解的 @Service
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-public class RemoteService implements InitializingBean, DisposableBean {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(RemoteService.class);
-
-    private List<String> list = new ArrayList<String>();
-
-    @Autowired
-    private RemoteServerConfig remoteServerConfig;
-
-    public void destroy() throws Exception {
-
-    }
-
-    public void afterPropertiesSet() throws Exception {
-
-        list.add(remoteServerConfig.getRemoteHost());
-        list.add(String.valueOf(remoteServerConfig.getRemoteHost()));
-    }
-
-    /**
-     * 更改Jedis
-     */
-    public void reload() {
-
-        LOGGER.info("start to reload remote service to: " + remoteServerConfig.getRemoteHost() + " : "
-                + remoteServerConfig.getRemoteHost());
-
-        list.add(remoteServerConfig.getRemoteHost());
-        list.add(String.valueOf(remoteServerConfig.getRemoteHost()));
-
-        LOGGER.info("reload ok.");
-    }
-}

+ 0 - 35
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/RemoteServiceUpdateCallback.java

@@ -1,35 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.config.RemoteServerConfig;
-
-/**
- * 这是RemoteService的回调函数类,这里不使用 @Service 进行注解
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@DisconfUpdateService(classes = { RemoteServerConfig.class })
-public class RemoteServiceUpdateCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(RemoteServiceUpdateCallback.class);
-
-    @Autowired
-    private RemoteService remoteService;
-
-    /**
-     * 
-     */
-    public void reload() throws Exception {
-
-        remoteService.reload();
-    }
-
-}

+ 0 - 80
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisService.java

@@ -1,80 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import redis.clients.jedis.Jedis;
-
-import com.example.disconf.demo.config.JedisConfig;
-import com.example.disconf.demo.utils.JedisUtil;
-
-/**
- * 一个简单的Redis服务
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-public class SimpleRedisService implements InitializingBean, DisposableBean {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRedisService.class);
-
-    // jedis 实例
-    private Jedis jedis = null;
-
-    /**
-     * 分布式配置
-     */
-    @Autowired
-    private JedisConfig jedisConfig;
-
-    /**
-     * 关闭
-     */
-    public void destroy() throws Exception {
-
-        if (jedis != null) {
-            jedis.disconnect();
-        }
-    }
-
-    /**
-     * 进行连接
-     */
-    public void afterPropertiesSet() throws Exception {
-
-        jedis = JedisUtil.createJedis(jedisConfig.getHost(), jedisConfig.getPort());
-    }
-
-    /**
-     * 获取一个值
-     * 
-     * @param key
-     * @return
-     */
-    public String getKey(String key) {
-        if (jedis != null) {
-            return jedis.get(key);
-        }
-
-        return null;
-    }
-
-    /**
-     * 更改Jedis
-     */
-    public void changeJedis() {
-
-        LOGGER.info("start to change jedis hosts to: " + jedisConfig.getHost() + " : " + jedisConfig.getPort());
-
-        jedis = JedisUtil.createJedis(jedisConfig.getHost(), jedisConfig.getPort());
-
-        LOGGER.info("change ok.");
-    }
-}

+ 0 - 38
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleRedisServiceUpdateCallback.java

@@ -1,38 +0,0 @@
-package com.example.disconf.demo.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
-import com.baidu.disconf.client.common.update.IDisconfUpdate;
-import com.example.disconf.demo.config.Coefficients;
-import com.example.disconf.demo.config.JedisConfig;
-
-/**
- * 更新Redis配置时的回调函数
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-@Scope("singleton")
-@DisconfUpdateService(classes = { JedisConfig.class }, itemKeys = { Coefficients.key })
-public class SimpleRedisServiceUpdateCallback implements IDisconfUpdate {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleRedisServiceUpdateCallback.class);
-
-    @Autowired
-    private SimpleRedisService simpleRedisService;
-
-    /**
-     * 
-     */
-    public void reload() throws Exception {
-
-        simpleRedisService.changeJedis();
-    }
-
-}

+ 0 - 35
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/service/SimpleStaticService.java

@@ -1,35 +0,0 @@
-package com.example.disconf.demo.service;
-
-import com.baidu.disconf.client.common.annotations.DisconfItem;
-import com.example.disconf.demo.config.StaticConfig;
-
-/**
- * 使用静态配置文件的示例<br/>
- * Plus <br/>
- * 静态配置项 使用示例
- * 
- * @author liaoqiqi
- * @version 2014-8-14
- */
-public class SimpleStaticService {
-
-    private static int staticItem = 56;
-
-    /**
-     * 
-     * @return
-     */
-    public static int getStaticFileData() {
-
-        return StaticConfig.getStaticVar();
-    }
-
-    @DisconfItem(key = "staticItem")
-    public static int getStaticItem() {
-        return staticItem;
-    }
-
-    public static void setStaticItem(int staticItem) {
-        SimpleStaticService.staticItem = staticItem;
-    }
-}

+ 0 - 67
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/task/DisconfDemoTask.java

@@ -1,67 +0,0 @@
-package com.example.disconf.demo.task;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.disconf.demo.config.JedisConfig;
-import com.example.disconf.demo.service.BaoBaoService;
-import com.example.disconf.demo.service.SimpleRedisService;
-import com.example.disconf.demo.service.SimpleStaticService;
-
-/**
- * 演示分布式配置文件、分布式配置的更新Demo
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-@Service
-public class DisconfDemoTask {
-
-    protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfDemoTask.class);
-
-    @Autowired
-    private BaoBaoService baoBaoService;
-
-    @Autowired
-    private SimpleRedisService simpleRedisService;
-
-    @Autowired
-    private JedisConfig jedisConfig;
-
-    private static final String REDIS_KEY = "disconf_key";
-
-    /**
-     * 
-     */
-    public int run() {
-
-        try {
-
-            while (true) {
-
-                LOGGER.info("baobao--baifa: " + baoBaoService.calcBaiFa());
-                LOGGER.info("baobao--yuerbao: " + baoBaoService.calcYuErBao());
-
-                Thread.sleep(5000);
-
-                // LOGGER.info("redis( " + jedisConfig.getHost() + ","
-                // + jedisConfig.getPort() + ")  get key: " + REDIS_KEY
-                // + " , " + simpleRedisService.getKey(REDIS_KEY));
-                LOGGER.info("redis( " + jedisConfig.getHost() + "," + jedisConfig.getPort() + ")");
-
-                LOGGER.info("static file data:" + SimpleStaticService.getStaticFileData());
-
-                LOGGER.info("static item data:" + SimpleStaticService.getStaticItem());
-
-            }
-
-        } catch (Exception e) {
-
-            LOGGER.error(e.toString(), e);
-        }
-
-        return 0;
-    }
-}

+ 0 - 33
disconf-demos/disconf-standalone-dubbo-demo/src/main/java/com/example/disconf/demo/utils/JedisUtil.java

@@ -1,33 +0,0 @@
-package com.example.disconf.demo.utils;
-
-import org.apache.commons.lang.StringUtils;
-
-import redis.clients.jedis.Jedis;
-
-/**
- * 
- * @author liaoqiqi
- * @version 2014-6-17
- */
-public class JedisUtil {
-
-    public static Jedis createJedis() {
-        Jedis jedis = new Jedis("127.0.0.1");
-        return jedis;
-    }
-
-    public static Jedis createJedis(String host, int port) {
-        Jedis jedis = new Jedis(host, port);
-
-        return jedis;
-    }
-
-    public static Jedis createJedis(String host, int port, String passwrod) {
-        Jedis jedis = new Jedis(host, port);
-
-        if (!StringUtils.isNotBlank(passwrod))
-            jedis.auth(passwrod);
-
-        return jedis;
-    }
-}

+ 0 - 62
disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/applicationContext.xml

@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-        http://www.springframework.org/schema/aop 
-        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-        http://www.springframework.org/schema/context 
-        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-    <context:component-scan base-package="com.baidu,com.example"/>
-
-    <aop:aspectj-autoproxy proxy-target-class="true"/>
-
-    <bean id="propertyConfigurerForProject1"
-          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-        <property name="order" value="1"/>
-        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
-        <property name="ignoreResourceNotFound" value="true"/>
-        <property name="ignoreUnresolvablePlaceholders" value="true"/>
-        <property name="locations">
-            <list>
-                <value>classpath*:/redis.properties</value>
-                <value>classpath*:/coefficients.properties</value>
-                <value>classpath*:/remote.properties</value>
-                <value>classpath*:/static.properties</value>
-            </list>
-        </property>
-    </bean>
-
-    <!-- 非托管的配置文件 disconf只负责推送 不会注入到代码里 -->
-    <bean id="disconfMgrJustHostFileBean"
-          class="com.baidu.disconf.client.mybeans.DisconfMgrJustHostFileBean">
-        <property name="justHostFiles">
-            <list>
-                <value>myserver.properties</value>
-            </list>
-        </property>
-    </bean>
-    <bean id="disconfMgrBean" class="com.baidu.disconf.client.DisconfMgrBean"
-          destroy-method="destory">
-        <property name="scanPackage" value="com.example.disconf.demo"/>
-    </bean>
-    <bean id="disconfMgrBean2" class="com.baidu.disconf.client.DisconfMgrBeanSecond"
-          init-method="init" destroy-method="destory">
-    </bean>
-
-    <!-- 非托管的配置文件 disconf只负责推送 不会注入到代码里 -->
-    <bean id="disconfMgrJustHostFileBean2"
-          class="com.baidu.disconf.client.mybeans.DisconfMgrJustHostFileBean">
-        <property name="justHostFiles">
-            <list>
-                <value>myserver_slave.properties</value>
-            </list>
-        </property>
-    </bean>
-
-    <import resource="classpath*:dubbo-provider.xml"/>
-
-</beans>

+ 0 - 30
disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/disconf.properties

@@ -1,30 +0,0 @@
-
-
-# \u662F\u5426\u4F7F\u7528\u8FDC\u7A0B\u914D\u7F6E\u6587\u4EF6
-# true(\u9ED8\u8BA4)\u4F1A\u4ECE\u8FDC\u7A0B\u83B7\u53D6\u914D\u7F6E false\u5219\u76F4\u63A5\u83B7\u53D6\u672C\u5730\u914D\u7F6E
-disconf.enable.remote.conf=true
-
-#
-# \u914D\u7F6E\u670D\u52A1\u5668\u7684 HOST,\u7528\u9017\u53F7\u5206\u9694  127.0.0.1:8000,127.0.0.1:8000
-#
-disconf.conf_server_host=127.0.0.1:8080
-
-# \u7248\u672C, \u8BF7\u91C7\u7528 X_X_X_X \u683C\u5F0F 
-disconf.version=1_0_0_0
-
-# APP \u8BF7\u91C7\u7528 \u4EA7\u54C1\u7EBF_\u670D\u52A1\u540D \u683C\u5F0F 
-disconf.app=disconf_demo
-
-# \u73AF\u5883
-disconf.env=rd
-
-# \u5FFD\u7565\u54EA\u4E9B\u5206\u5E03\u5F0F\u914D\u7F6E\uFF0C\u7528\u9017\u53F7\u5206\u9694
-disconf.ignore=
-
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u6B21\u6570\uFF0C\u9ED8\u8BA4\u662F3\u6B21
-disconf.conf_server_url_retry_times=1
-# \u83B7\u53D6\u8FDC\u7A0B\u914D\u7F6E \u91CD\u8BD5\u65F6\u4F11\u7720\u65F6\u95F4\uFF0C\u9ED8\u8BA4\u662F5\u79D2
-disconf.conf_server_url_retry_sleep_seconds=1
-
-# \u7528\u6237\u6307\u5B9A\u7684\u4E0B\u8F7D\u6587\u4EF6\u5939, \u8FDC\u7A0B\u6587\u4EF6\u4E0B\u8F7D\u540E\u4F1A\u653E\u5728\u8FD9\u91CC
-disconf.user_define_download_dir=./disconf/download2

+ 0 - 23
disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/dubbo-consumer.xml

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans.xsd
-        http://code.alibabatech.com/schema/dubbo
-        http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- 
-    <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
-    <dubbo:application name="consumer-of-dubbo-service-app"  />
-
- 
-    <!-- 使用multicast广播注册中心暴露发现服务地址 -->
-    <dubbo:registry address="zookeeper://127.0.0.1:8581" />
-
- 
-    <!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
-    <dubbo:reference id="dubboService" interface="com.example.disconf.demo.dubbo.service.DubboService" />
-
-</beans>

+ 0 - 25
disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/dubbo-provider.xml

@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>  
-<beans xmlns="http://www.springframework.org/schema/beans"  
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"  
-    xsi:schemaLocation="http://www.springframework.org/schema/beans  
-        http://www.springframework.org/schema/beans/spring-beans.xsd  
-        http://code.alibabatech.com/schema/dubbo  
-        http://code.alibabatech.com/schema/dubbo/dubbo.xsd  ">  
-  
-    <!-- 提供方应用信息,用于计算依赖关系 -->  
-    <dubbo:application name="dubbo-service-app" />  
-  
-    <!-- 使用zookeeper注册中心暴露服务地址 -->  
-    <dubbo:registry address="zookeeper://127.0.0.1:8581" />  
-  
-    <!-- 用dubbo协议在20880端口暴露服务 -->  
-    <dubbo:protocol name="dubbo" port="20880" />  
-  
-    <!-- 声明需要暴露的服务接口 -->  
-    <dubbo:service interface="com.example.disconf.demo.dubbo.service.DubboService"  
-        ref="dubboService" />  
-  
-    <!-- 和本地bean一样实现服务 -->  
-    <bean id="dubboService" class="com.example.disconf.demo.dubbo.service.impl.DubboServiceImpl" />  
-  
-</beans>  

+ 0 - 58
disconf-demos/disconf-standalone-dubbo-demo/src/main/resources/logback.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<configuration>
-
-    <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
-
-    <jmxConfigurator />
-
-    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <property name="log.base" value="./log/disconf-demo" />
-    <appender name="logfile"
-        class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <File>${log.base}.log</File>
-        <rollingPolicy
-            class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <FileNamePattern>${log.base}.%d{yyyy-MM-dd}.log
-            </FileNamePattern>
-        </rollingPolicy>
-        <encoder>
-            <pattern>%date [%thread] %-5level %logger{80} - %msg%n
-            </pattern>
-        </encoder>
-    </appender>
-
-    <logger name="com.baidu.disconf">
-        <level value="DEBUG" />
-    </logger>
-
-    <logger name="com.baidu.disconf.demo">
-        <level value="INFO" />
-        <appender-ref ref="logfile" />
-    </logger>
-
-    <logger name="org.springframework">
-        <level value="WARN" />
-    </logger>
-
-    <logger name="net.sf.ehcache">
-        <level value="ERROR" />
-    </logger>
-
-    <logger name="org.springmodules">
-        <level value="ERROR" />
-    </logger>
-
-    <root level="INFO">
-        <appender-ref ref="stdout" />
-        <appender-ref ref="logfile" />
-    </root>
-
-</configuration>
-

+ 0 - 18
disconf-demos/pom.xml

@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>com.baidu.disconf</groupId>
-    <artifactId>disconf-demos</artifactId>
-    <version>2.0.0</version>
-    <packaging>pom</packaging>
-
-
-    <modules>
-        <module>disconf-spring-boot-demo</module>
-        <module>disconf-standalone-demo</module>
-        <module>disconf-standalone-dubbo-demo</module>
-    </modules>
-
-</project>

+ 1 - 1
pom.xml

@@ -61,7 +61,7 @@
             <dependency>
                 <groupId>com.github.knightliao.apollo</groupId>
                 <artifactId>apollo</artifactId>
-                <version>1.0.8</version>
+                <version>1.0.10-SNAPSHOT</version>
             </dependency>
 
             <!-- common dependencies -->