diff --git a/.gitignore b/.gitignore index 0f69c283..8c371b54 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,225 @@ target 2-Dalston版教程示例/trace-2/build/bootstrap.json 2-Dalston版教程示例/trace-2/build/springAppName_IS_UNDEFINED.json 2-Dalston版教程示例/trace-2/build/trace-2.json +### Eclipse template + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ +cmake-build-release/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +/2-Dalston/eureka-consumer-ribbon/eureka-consumer-ribbon.iml +/2-Dalston/eureka-consumer-ribbon/target/ +1-Brixton/Chapter1-1-1/compute-service/.classpath +1-Brixton/Chapter1-1-1/compute-service/.project +1-Brixton/Chapter1-1-1/eureka-server/.classpath +1-Brixton/Chapter1-1-1/eureka-server/.project +1-Brixton/Chapter1-1-2/eureka-feign/.classpath +1-Brixton/Chapter1-1-2/eureka-feign/.project +1-Brixton/Chapter1-1-2/eureka-ribbon/.classpath +1-Brixton/Chapter1-1-2/eureka-ribbon/.project +1-Brixton/Chapter1-1-4/config-client/.classpath +1-Brixton/Chapter1-1-4/config-client/.project +1-Brixton/Chapter1-1-4/config-server/.classpath +1-Brixton/Chapter1-1-4/config-server/.project +1-Brixton/Chapter1-1-5/api-gateway/.classpath +1-Brixton/Chapter1-1-5/api-gateway/.project +1-Brixton/Chapter1-1-5/service-A/.classpath +1-Brixton/Chapter1-1-5/service-A/.project +1-Brixton/Chapter1-1-5/service-B/.classpath +1-Brixton/Chapter1-1-5/service-B/.project +1-Brixton/Chapter1-1-7/config-client-eureka-kafka/.classpath +1-Brixton/Chapter1-1-7/config-client-eureka-kafka/.project +1-Brixton/Chapter1-1-7/config-client-eureka/.classpath +1-Brixton/Chapter1-1-7/config-client-eureka/.project +1-Brixton/Chapter1-1-7/config-server-eureka-kafka/.classpath +1-Brixton/Chapter1-1-7/config-server-eureka-kafka/.project +1-Brixton/Chapter1-1-7/config-server-eureka/.classpath +1-Brixton/Chapter1-1-7/config-server-eureka/.project +2-Dalston/config-server-git/.classpath +2-Dalston/config-server-git/.project +2-Dalston/consul-consumer/.classpath +2-Dalston/consul-consumer/.project +2-Dalston/eureka-consumer-feign-hystrix/.classpath +2-Dalston/eureka-consumer-feign-hystrix/.project +2-Dalston/eureka-consumer-ribbon/.classpath +2-Dalston/eureka-consumer-ribbon/.project +2-Dalston/eureka-feign-api/.classpath +2-Dalston/eureka-feign-api/.project +2-Dalston/eureka-feign-client/.classpath +2-Dalston/eureka-feign-client/.project +2-Dalston/eureka-feign-consumer/.classpath +2-Dalston/eureka-feign-consumer/.project +2-Dalston/hystrix-collapser-provider/.classpath +2-Dalston/hystrix-collapser-provider/.project +spring_cloud_in_action/.project +spring_cloud_in_action/api-gateway-consul/.classpath +spring_cloud_in_action/api-gateway-consul/.project +spring_cloud_in_action/api-gateway-dynamic-filter/.classpath +spring_cloud_in_action/api-gateway-dynamic-filter/.project +spring_cloud_in_action/api-gateway-dynamic-route/.classpath +spring_cloud_in_action/api-gateway-dynamic-route/.project +spring_cloud_in_action/api-gateway-exception/.classpath +spring_cloud_in_action/api-gateway-exception/.project +spring_cloud_in_action/config-client-eureka-rabbit/.classpath +spring_cloud_in_action/config-client-eureka-rabbit/.project +spring_cloud_in_action/config-server-eureka-rabbit/.classpath +spring_cloud_in_action/config-server-eureka-rabbit/.project +spring_cloud_in_action/consul-client-1/.classpath +spring_cloud_in_action/consul-client-1/.project +spring_cloud_in_action/eureka-server-ha/.classpath +spring_cloud_in_action/eureka-server-ha/.project +spring_cloud_in_action/feign-consumer/.classpath +spring_cloud_in_action/feign-consumer/.project +spring_cloud_in_action/hello-service-api/.classpath +spring_cloud_in_action/hello-service-api/.project +spring_cloud_in_action/hello-service/.classpath +spring_cloud_in_action/hello-service/.project +spring_cloud_in_action/rabbitmq-hello/.classpath +spring_cloud_in_action/rabbitmq-hello/.project +spring_cloud_in_action/ribbon-consumer/.classpath +spring_cloud_in_action/ribbon-consumer/.project +spring_cloud_in_action/spring-boot-hello/.classpath +spring_cloud_in_action/spring-boot-hello/.project +spring_cloud_in_action/stream-consumer/.classpath +spring_cloud_in_action/stream-consumer/.project +spring_cloud_in_action/stream-producer/.classpath +spring_cloud_in_action/stream-producer/.project +spring_cloud_in_action/trace-1/.classpath +spring_cloud_in_action/trace-1/.project +spring_cloud_in_action/trace-2/.classpath +spring_cloud_in_action/trace-2/.project +spring_cloud_in_action/trace-stream-1/.classpath +spring_cloud_in_action/trace-stream-1/.project +spring_cloud_in_action/trace-stream-2/.classpath +spring_cloud_in_action/trace-stream-2/.project +spring_cloud_in_action/zipkin-server-stream-mysql/.classpath +spring_cloud_in_action/zipkin-server-stream-mysql/.project +spring_cloud_in_action/zipkin-server-stream/.classpath +spring_cloud_in_action/zipkin-server-stream/.project +spring_cloud_in_action/zipkin-server/.classpath +spring_cloud_in_action/zipkin-server/.project +/build/ +build/ \ No newline at end of file diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/pom.xml" b/1-Brixton/Chapter1-1-1/compute-service/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/pom.xml" rename to 1-Brixton/Chapter1-1-1/compute-service/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" b/1-Brixton/Chapter1-1-1/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" rename to 1-Brixton/Chapter1-1-1/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/java/com/didispace/web/ComputeController.java" b/1-Brixton/Chapter1-1-1/compute-service/src/main/java/com/didispace/web/ComputeController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/java/com/didispace/web/ComputeController.java" rename to 1-Brixton/Chapter1-1-1/compute-service/src/main/java/com/didispace/web/ComputeController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-1/compute-service/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-1/compute-service/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java" b/1-Brixton/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java" rename to 1-Brixton/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/pom.xml" b/1-Brixton/Chapter1-1-1/eureka-server/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/pom.xml" rename to 1-Brixton/Chapter1-1-1/eureka-server/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-1/eureka-server/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-1/eureka-server/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-1/eureka-server/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/pom.xml" b/1-Brixton/Chapter1-1-2/eureka-feign/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/pom.xml" rename to 1-Brixton/Chapter1-1-2/eureka-feign/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/FeignApplication.java" b/1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/FeignApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/FeignApplication.java" rename to 1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/FeignApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java" b/1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java" rename to 1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java" b/1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java" rename to 1-Brixton/Chapter1-1-2/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-2/eureka-feign/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-feign/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-2/eureka-feign/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/pom.xml" b/1-Brixton/Chapter1-1-2/eureka-ribbon/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/pom.xml" rename to 1-Brixton/Chapter1-1-2/eureka-ribbon/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java" b/1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java" rename to 1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java" b/1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java" rename to 1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-2/eureka-ribbon/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-2/eureka-ribbon/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/pom.xml" b/1-Brixton/Chapter1-1-3/compute-service/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/pom.xml" rename to 1-Brixton/Chapter1-1-3/compute-service/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" b/1-Brixton/Chapter1-1-3/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" rename to 1-Brixton/Chapter1-1-3/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/java/com/didispace/web/ComputeController.java" b/1-Brixton/Chapter1-1-3/compute-service/src/main/java/com/didispace/web/ComputeController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/java/com/didispace/web/ComputeController.java" rename to 1-Brixton/Chapter1-1-3/compute-service/src/main/java/com/didispace/web/ComputeController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-3/compute-service/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-3/compute-service/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/test/java/com/didispace/ApplicationTests.java" b/1-Brixton/Chapter1-1-3/compute-service/src/test/java/com/didispace/ApplicationTests.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/compute-service/src/test/java/com/didispace/ApplicationTests.java" rename to 1-Brixton/Chapter1-1-3/compute-service/src/test/java/com/didispace/ApplicationTests.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/pom.xml" b/1-Brixton/Chapter1-1-3/eureka-feign/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/pom.xml" rename to 1-Brixton/Chapter1-1-3/eureka-feign/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/FeignApplication.java" b/1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/FeignApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/FeignApplication.java" rename to 1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/FeignApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java" b/1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java" rename to 1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClientHystrix.java" b/1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClientHystrix.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClientHystrix.java" rename to 1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClientHystrix.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java" b/1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java" rename to 1-Brixton/Chapter1-1-3/eureka-feign/src/main/java/com/didispace/web/ConsumerController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/pom.xml" b/1-Brixton/Chapter1-1-3/eureka-ribbon/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/pom.xml" rename to 1-Brixton/Chapter1-1-3/eureka-ribbon/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java" b/1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java" rename to 1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/RibbonApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/service/ComputeService.java" b/1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/service/ComputeService.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/service/ComputeService.java" rename to 1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/service/ComputeService.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java" b/1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java" rename to 1-Brixton/Chapter1-1-3/eureka-ribbon/src/main/java/com/didispace/web/ConsumerController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/pom.xml" b/1-Brixton/Chapter1-1-3/eureka-server/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/pom.xml" rename to 1-Brixton/Chapter1-1-3/eureka-server/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-3/eureka-server/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-3/eureka-server/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-3/eureka-server/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-3/eureka-server/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-3/eureka-server/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/pom.xml" b/1-Brixton/Chapter1-1-4/config-client/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/pom.xml" rename to 1-Brixton/Chapter1-1-4/config-client/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-4/config-client/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-4/config-client/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/java/com/didispace/web/TestController.java" b/1-Brixton/Chapter1-1-4/config-client/src/main/java/com/didispace/web/TestController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/java/com/didispace/web/TestController.java" rename to 1-Brixton/Chapter1-1-4/config-client/src/main/java/com/didispace/web/TestController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/resources/bootstrap.properties" b/1-Brixton/Chapter1-1-4/config-client/src/main/resources/bootstrap.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-client/src/main/resources/bootstrap.properties" rename to 1-Brixton/Chapter1-1-4/config-client/src/main/resources/bootstrap.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-dev.properties" b/1-Brixton/Chapter1-1-4/config-repo/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-4/config-repo/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-prod.properties" b/1-Brixton/Chapter1-1-4/config-repo/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-4/config-repo/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-test.properties" b/1-Brixton/Chapter1-1-4/config-repo/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace-test.properties" rename to 1-Brixton/Chapter1-1-4/config-repo/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace.properties" b/1-Brixton/Chapter1-1-4/config-repo/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-repo/didispace.properties" rename to 1-Brixton/Chapter1-1-4/config-repo/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/pom.xml" b/1-Brixton/Chapter1-1-4/config-server/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/pom.xml" rename to 1-Brixton/Chapter1-1-4/config-server/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-4/config-server/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-4/config-server/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-dev.properties" b/1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-prod.properties" b/1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-test.properties" b/1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace-test.properties" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace.properties" b/1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-4/config-server/src/main/resources/didispace.properties" rename to 1-Brixton/Chapter1-1-4/config-server/src/main/resources/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/pom.xml" b/1-Brixton/Chapter1-1-5/api-gateway/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/pom.xml" rename to 1-Brixton/Chapter1-1-5/api-gateway/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-5/api-gateway/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-5/api-gateway/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/java/com/didispace/filter/AccessFilter.java" b/1-Brixton/Chapter1-1-5/api-gateway/src/main/java/com/didispace/filter/AccessFilter.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/java/com/didispace/filter/AccessFilter.java" rename to 1-Brixton/Chapter1-1-5/api-gateway/src/main/java/com/didispace/filter/AccessFilter.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-5/api-gateway/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/api-gateway/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-5/api-gateway/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/pom.xml" b/1-Brixton/Chapter1-1-5/eureka-server/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/pom.xml" rename to 1-Brixton/Chapter1-1-5/eureka-server/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-5/eureka-server/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-5/eureka-server/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-5/eureka-server/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/eureka-server/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-5/eureka-server/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/pom.xml" b/1-Brixton/Chapter1-1-5/service-A/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/pom.xml" rename to 1-Brixton/Chapter1-1-5/service-A/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/java/com/didispace/ComputeServiceApplication.java" b/1-Brixton/Chapter1-1-5/service-A/src/main/java/com/didispace/ComputeServiceApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/java/com/didispace/ComputeServiceApplication.java" rename to 1-Brixton/Chapter1-1-5/service-A/src/main/java/com/didispace/ComputeServiceApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/java/com/didispace/web/ComputeController.java" b/1-Brixton/Chapter1-1-5/service-A/src/main/java/com/didispace/web/ComputeController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/java/com/didispace/web/ComputeController.java" rename to 1-Brixton/Chapter1-1-5/service-A/src/main/java/com/didispace/web/ComputeController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-5/service-A/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-5/service-A/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/test/java/com/didispace/ApplicationTests.java" b/1-Brixton/Chapter1-1-5/service-A/src/test/java/com/didispace/ApplicationTests.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-A/src/test/java/com/didispace/ApplicationTests.java" rename to 1-Brixton/Chapter1-1-5/service-A/src/test/java/com/didispace/ApplicationTests.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/pom.xml" b/1-Brixton/Chapter1-1-5/service-B/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/pom.xml" rename to 1-Brixton/Chapter1-1-5/service-B/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/java/com/didispace/ComputeServiceApplication.java" b/1-Brixton/Chapter1-1-5/service-B/src/main/java/com/didispace/ComputeServiceApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/java/com/didispace/ComputeServiceApplication.java" rename to 1-Brixton/Chapter1-1-5/service-B/src/main/java/com/didispace/ComputeServiceApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/java/com/didispace/web/ComputeController.java" b/1-Brixton/Chapter1-1-5/service-B/src/main/java/com/didispace/web/ComputeController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/java/com/didispace/web/ComputeController.java" rename to 1-Brixton/Chapter1-1-5/service-B/src/main/java/com/didispace/web/ComputeController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-5/service-B/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-5/service-B/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/test/java/com/didispace/ApplicationTests.java" b/1-Brixton/Chapter1-1-5/service-B/src/test/java/com/didispace/ApplicationTests.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-5/service-B/src/test/java/com/didispace/ApplicationTests.java" rename to 1-Brixton/Chapter1-1-5/service-B/src/test/java/com/didispace/ApplicationTests.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/pom.xml" b/1-Brixton/Chapter1-1-6/compute-service/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/pom.xml" rename to 1-Brixton/Chapter1-1-6/compute-service/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" b/1-Brixton/Chapter1-1-6/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java" rename to 1-Brixton/Chapter1-1-6/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/java/com/didispace/web/ComputeController.java" b/1-Brixton/Chapter1-1-6/compute-service/src/main/java/com/didispace/web/ComputeController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/java/com/didispace/web/ComputeController.java" rename to 1-Brixton/Chapter1-1-6/compute-service/src/main/java/com/didispace/web/ComputeController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-6/compute-service/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-6/compute-service/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/test/java/com/didispace/ApplicationTests.java" b/1-Brixton/Chapter1-1-6/compute-service/src/test/java/com/didispace/ApplicationTests.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/compute-service/src/test/java/com/didispace/ApplicationTests.java" rename to 1-Brixton/Chapter1-1-6/compute-service/src/test/java/com/didispace/ApplicationTests.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/pom.xml" b/1-Brixton/Chapter1-1-6/eureka-server/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/pom.xml" rename to 1-Brixton/Chapter1-1-6/eureka-server/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-6/eureka-server/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-6/eureka-server/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/resources/application-peer1.properties" b/1-Brixton/Chapter1-1-6/eureka-server/src/main/resources/application-peer1.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/resources/application-peer1.properties" rename to 1-Brixton/Chapter1-1-6/eureka-server/src/main/resources/application-peer1.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/resources/application-peer2.properties" b/1-Brixton/Chapter1-1-6/eureka-server/src/main/resources/application-peer2.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-6/eureka-server/src/main/resources/application-peer2.properties" rename to 1-Brixton/Chapter1-1-6/eureka-server/src/main/resources/application-peer2.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/pom.xml" b/1-Brixton/Chapter1-1-7/config-client-eureka-kafka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/pom.xml" rename to 1-Brixton/Chapter1-1-7/config-client-eureka-kafka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/web/TestController.java" b/1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/web/TestController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/web/TestController.java" rename to 1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/web/TestController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/resources/bootstrap.properties" b/1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/resources/bootstrap.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka-kafka/src/main/resources/bootstrap.properties" rename to 1-Brixton/Chapter1-1-7/config-client-eureka-kafka/src/main/resources/bootstrap.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/pom.xml" b/1-Brixton/Chapter1-1-7/config-client-eureka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/pom.xml" rename to 1-Brixton/Chapter1-1-7/config-client-eureka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/web/TestController.java" b/1-Brixton/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/web/TestController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/web/TestController.java" rename to 1-Brixton/Chapter1-1-7/config-client-eureka/src/main/java/com/didispace/web/TestController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/resources/bootstrap.properties" b/1-Brixton/Chapter1-1-7/config-client-eureka/src/main/resources/bootstrap.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-client-eureka/src/main/resources/bootstrap.properties" rename to 1-Brixton/Chapter1-1-7/config-client-eureka/src/main/resources/bootstrap.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-dev.properties" b/1-Brixton/Chapter1-1-7/config-repo/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-7/config-repo/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-prod.properties" b/1-Brixton/Chapter1-1-7/config-repo/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-7/config-repo/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-test.properties" b/1-Brixton/Chapter1-1-7/config-repo/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace-test.properties" rename to 1-Brixton/Chapter1-1-7/config-repo/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace.properties" b/1-Brixton/Chapter1-1-7/config-repo/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-repo/didispace.properties" rename to 1-Brixton/Chapter1-1-7/config-repo/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/pom.xml" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/pom.xml" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-dev.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-prod.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-test.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-test.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/pom.xml" b/1-Brixton/Chapter1-1-7/config-server-eureka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/pom.xml" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-dev.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-prod.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-test.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-test.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace.properties" b/1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-7/config-server-eureka/src/main/resources/didispace.properties" rename to 1-Brixton/Chapter1-1-7/config-server-eureka/src/main/resources/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/pom.xml" b/1-Brixton/Chapter1-1-8/config-client-eureka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/pom.xml" rename to 1-Brixton/Chapter1-1-8/config-client-eureka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/web/TestController.java" b/1-Brixton/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/web/TestController.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/web/TestController.java" rename to 1-Brixton/Chapter1-1-8/config-client-eureka/src/main/java/com/didispace/web/TestController.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/resources/bootstrap.properties" b/1-Brixton/Chapter1-1-8/config-client-eureka/src/main/resources/bootstrap.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-client-eureka/src/main/resources/bootstrap.properties" rename to 1-Brixton/Chapter1-1-8/config-client-eureka/src/main/resources/bootstrap.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-dev.properties" b/1-Brixton/Chapter1-1-8/config-repo/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-8/config-repo/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-prod.properties" b/1-Brixton/Chapter1-1-8/config-repo/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-8/config-repo/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-test.properties" b/1-Brixton/Chapter1-1-8/config-repo/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace-test.properties" rename to 1-Brixton/Chapter1-1-8/config-repo/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace.properties" b/1-Brixton/Chapter1-1-8/config-repo/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-repo/didispace.properties" rename to 1-Brixton/Chapter1-1-8/config-repo/didispace.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/pom.xml" b/1-Brixton/Chapter1-1-8/config-server-eureka/pom.xml similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/pom.xml" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/pom.xml diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/java/com/didispace/Application.java" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/java/com/didispace/Application.java similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/java/com/didispace/Application.java" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/java/com/didispace/Application.java diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/application.properties" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/application.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/application.properties" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/application.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-dev.properties" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-dev.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-dev.properties" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-dev.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-prod.properties" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-prod.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-prod.properties" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-prod.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-test.properties" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-test.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-test.properties" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace-test.properties diff --git "a/1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace.properties" b/1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace.properties similarity index 100% rename from "1-Brixton\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/Chapter1-1-8/config-server-eureka/src/main/resources/didispace.properties" rename to 1-Brixton/Chapter1-1-8/config-server-eureka/src/main/resources/didispace.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/pom.xml" b/2-Dalston/api-gateway-with-eureka/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/pom.xml" rename to 2-Dalston/api-gateway-with-eureka/pom.xml diff --git a/2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java b/2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java new file mode 100644 index 00000000..4527f415 --- /dev/null +++ b/2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java @@ -0,0 +1,66 @@ +package com.didispace; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.HttpServletRequest; + +/*网关服务的加入,外部客户端访问我们的系统已经有了统一入口,既然这些校验与具体业务无关,那何不在请求到达的时候就完成校验和过滤,而不是转发后再过滤而导致更长的请求延迟。 +同时,通过在网关中完成校验和过滤,微服务应用端就可以去除各种复杂的过滤器和拦截器了,这使得微服务应用的接口开发和测试复杂度也得到了相应的降低。 + +为了在API网关中实现对客户端请求的校验,我们将需要使用到Spring Cloud Zuul的另外一个核心功能:过滤器。 + +Zuul允许开发者在API网关上通过定义过滤器来实现对请求的拦截与过滤,实现的方法非常简单,我们只需要继承ZuulFilter抽象类并实现它定义的四个抽象函数就可以完成对请求的拦截和过滤了。 + +可以根据自己的需要在服务网关上定义一些与业务无关的通用逻辑实现对请求的过滤和拦截,比如:签名校验、权限校验、请求限流等功能。 +*/ +public class AccessFilter extends ZuulFilter { + private static Logger log = LoggerFactory.getLogger(AccessFilter.class); + + /*filterType:过滤器的类型,它决定过滤器在请求的哪个生命周期中执行。 + 这里定义为pre,代表会在请求被路由之前执行。*/ + @Override + public String filterType() { + return "pre"; + } + + /*filterOrder:过滤器的执行顺序。 + 当请求在一个阶段中存在多个过滤器时,需要根据该方法返回的值来依次执行。*/ + @Override + public int filterOrder() { + return 0; + } + + /*shouldFilter:判断该过滤器是否需要被执行。 + 这里我们直接返回了true,因此该过滤器对所有请求都会生效。 + 实际运用中我们可以利用该函数来指定过滤器的有效范围。*/ + @Override + public boolean shouldFilter() { + return true; + } + + /*run:过滤器的具体逻辑。 + 这里我们通过ctx.setSendZuulResponse(false)令zuul过滤该请求,不对其进行路由, + 然后通过ctx.setResponseStatusCode(401)设置了其返回的错误码,当然我们也可以进一步优化我们的返回, + 比如,通过ctx.setResponseBody(body)对返回body内容进行编辑等。*/ + @Override + public Object run() { + RequestContext ctx = RequestContext.getCurrentContext(); + HttpServletRequest request = ctx.getRequest(); + + log.info("send {} request to {}", request.getMethod(), request.getRequestURL().toString()); + + Object accessToken = request.getParameter("accessToken"); + if (accessToken == null) { + log.warn("access token is empty"); + ctx.setSendZuulResponse(false); + ctx.setResponseStatusCode(401); + return null; + } + log.info("access token ok"); + return null; + } + +} \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/Application.java" b/2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/Application.java similarity index 68% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/Application.java" rename to 2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/Application.java index 225959c6..a16ff102 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/Application.java" +++ b/2-Dalston/api-gateway-with-eureka/src/main/java/com/didispace/Application.java @@ -3,6 +3,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; +import org.springframework.context.annotation.Bean; @EnableZuulProxy @SpringCloudApplication @@ -12,4 +13,10 @@ public static void main(String[] args) { new SpringApplicationBuilder(Application.class).web(true).run(args); } + /*创建具体的Bean启动该过滤器*/ + @Bean + public AccessFilter accessFilter() { + return new AccessFilter(); + } + } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/resources/application.yaml" b/2-Dalston/api-gateway-with-eureka/src/main/resources/application.yaml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/resources/application.yaml" rename to 2-Dalston/api-gateway-with-eureka/src/main/resources/application.yaml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/pom.xml" b/2-Dalston/api-gateway/pom.xml similarity index 98% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/pom.xml" rename to 2-Dalston/api-gateway/pom.xml index e720d3b1..2d1fddc9 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/pom.xml" +++ b/2-Dalston/api-gateway/pom.xml @@ -24,6 +24,7 @@ + org.springframework.cloud spring-cloud-starter-zuul diff --git a/2-Dalston/api-gateway/src/main/java/com/didispace/Application.java b/2-Dalston/api-gateway/src/main/java/com/didispace/Application.java new file mode 100644 index 00000000..5e3b54be --- /dev/null +++ b/2-Dalston/api-gateway/src/main/java/com/didispace/Application.java @@ -0,0 +1,25 @@ +package com.didispace; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; + +/*使用@EnableZuulProxy注解开启Zuul的功能*/ +@EnableZuulProxy +@SpringCloudApplication +public class Application { + + public static void main(String[] args) { + new SpringApplicationBuilder(Application.class).web(true).run(args); + } +} +/* +服务网关是微服务架构中一个不可或缺的部分。 + +通过服务网关统一向外系统提供REST API的过程中,除了具备服务路由、均衡负载功能之外,它还具备了权限控制等功能。 + +Spring Cloud Netflix中的Zuul就担任了这样的一个角色, + 为微服务架构提供了前门保护的作用, + 同时将权限控制这些较重的非业务逻辑内容迁移到服务路由层面, +使得服务集群主体能够具备更高的可复用性和可测试性。 +*/ \ No newline at end of file diff --git a/2-Dalston/api-gateway/src/main/resources/application.yaml b/2-Dalston/api-gateway/src/main/resources/application.yaml new file mode 100644 index 00000000..52796f30 --- /dev/null +++ b/2-Dalston/api-gateway/src/main/resources/application.yaml @@ -0,0 +1,35 @@ +spring: + application: + name: api-gateway + +server: + port: 1101 + +zuul: + routes: +# single-instance 单实例配置:通过一组zuul.routes..path与zuul.routes..url参数对的方式配置 + api-a: + path: /api-a/** + url: http://localhost:2001/ +# multi-instance 多实例配置:通过一组zuul.routes..path与zuul.routes..serviceId参数对的方式配置 +# 可以指定为任意的路由名称 + + api-b: + path: /api-b/** + serviceId: api-b + +api-b: + ribbon: + listOfServers: http://localhost:2001/, http://localhost:2002/ +# 由于存在多个实例,API网关在进行路由转发时需要实现负载均衡策略,于是这里需要Spring Cloud Ribbon的配合,Spring Cloud Zuul中自带了对Ribbon的依赖。 + + +# 除了使用path与serviceId映射的配置方式之外,还有一种更简洁的配置方式:zuul.routes.=,其中用来指定路由的具体服务名,用来配置匹配的请求表达式。 + +# 没有配置任何实例地址的情况下,外部请求经过API网关的时候,它是如何被解析并转发到服务具体实例的呢? +# 在Spring Cloud Netflix中,Zuul巧妙的整合了Eureka来实现面向服务的路由。 +# 实际上,我们可以直接将API网关也看做是Eureka服务治理下的一个普通微服务应用。 +# 它除了会将自己注册到Eureka服务注册中心上之外,也会从注册中心获取所有服务以及它们的实例清单。 +# 所以,在Eureka的帮助下,API网关服务本身就已经维护了系统中所有serviceId与实例地址的映射关系。 +# 当有外部请求到达API网关的时候,根据请求的URL路径找到最佳匹配的path规则,API网关就可以知道要将该请求路由到哪个具体的serviceId上去。 +# 由于在API网关中已经知道serviceId对应服务实例的地址清单,那么只需要通过Ribbon的负载均衡策略,直接在这些清单中选择一个具体的实例进行转发就能完成路由工作了。 diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/pom.xml" b/2-Dalston/config-client/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/pom.xml" rename to 2-Dalston/config-client/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/java/com/didispace/Application.java" b/2-Dalston/config-client/src/main/java/com/didispace/ConfigClientApplication.java similarity index 65% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/java/com/didispace/Application.java" rename to 2-Dalston/config-client/src/main/java/com/didispace/ConfigClientApplication.java index 1aeb7b24..89baa654 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/java/com/didispace/Application.java" +++ b/2-Dalston/config-client/src/main/java/com/didispace/ConfigClientApplication.java @@ -3,12 +3,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -//@EnableDiscoveryClient @SpringBootApplication -public class Application { +public class ConfigClientApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(ConfigClientApplication.class).web(true).run(args); } } diff --git a/2-Dalston/config-client/src/main/resources/bootstrap.yml b/2-Dalston/config-client/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..89e549b5 --- /dev/null +++ b/2-Dalston/config-client/src/main/resources/bootstrap.yml @@ -0,0 +1,17 @@ +spring: + application: + name: config-client + cloud: + config: + uri: http://localhost:1201/ + profile: default + label: master + +server: + port: 2002 + + +# spring.application.name:对应配置文件规则中的{application}部分 +# spring.cloud.config.profile:对应配置文件规则中的{profile}部分 +# spring.cloud.config.label:对应配置文件规则中的{label}部分 +# spring.cloud.config.uri:配置中心config-server的地址 diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/pom.xml" b/2-Dalston/config-server-git/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/pom.xml" rename to 2-Dalston/config-server-git/pom.xml diff --git a/2-Dalston/config-server-git/src/main/java/com/didispace/ConfigServerApplication.java b/2-Dalston/config-server-git/src/main/java/com/didispace/ConfigServerApplication.java new file mode 100644 index 00000000..a637be4d --- /dev/null +++ b/2-Dalston/config-server-git/src/main/java/com/didispace/ConfigServerApplication.java @@ -0,0 +1,29 @@ +package com.didispace; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.config.server.EnableConfigServer; + +/*添加@EnableConfigServer注解,开启Spring Cloud Config的服务端功能。*/ +@EnableConfigServer +@SpringBootApplication +public class ConfigServerApplication { + + public static void main(String[] args) { + new SpringApplicationBuilder(ConfigServerApplication.class).web(true).run(args); + } + +} +/** + * Spring Cloud Config是Spring Cloud团队创建的一个全新项目,用来为分布式系统中的基础设施和微服务应用提供集中化的外部配置支持,它分为服务端与客户端两个部分。 + * + * 其中服务端也称为分布式配置中心,它是一个独立的微服务应用,用来连接配置仓库并为客户端提供获取配置信息、加密/解密信息等访问接口; + * 而客户端则是微服务架构中的各个微服务应用或基础设施,它们通过指定的配置中心来管理应用资源与业务相关的配置内容,并在启动的时候从配置中心获取和加载配置信息。 + * + * Spring Cloud Config实现了对服务端和客户端中环境变量和属性配置的抽象映射,所以它除了适用于Spring构建的应用程序之外,也可以在任何其他语言运行的应用程序中使用。 + * + * 由于Spring Cloud Config实现的配置中心默认采用Git来存储配置信息,所以使用Spring Cloud Config构建的配置服务器, + * 天然就支持对微服务应用配置信息的版本管理,并且可以通过Git客户端工具来方便的管理和访问配置内容。 + * + * 当然它也提供了对其他存储方式的支持,比如:SVN仓库、本地化文件系统。 + */ \ No newline at end of file diff --git a/2-Dalston/config-server-git/src/main/resources/application.yml b/2-Dalston/config-server-git/src/main/resources/application.yml new file mode 100644 index 00000000..78358599 --- /dev/null +++ b/2-Dalston/config-server-git/src/main/resources/application.yml @@ -0,0 +1,31 @@ +spring: + application: + name: config-server + cloud: + config: + server: + git: + uri: https://gitee.com/pdb2010/config-server +# search-paths: repo + username: pangdabo2010@hotmail.com + password: ZXCVbnm.123 + +server: + port: 1202 + +# 如果我们的Git仓库需要权限访问,那么可以通过配置下面的两个属性来实现; +# spring.cloud.config.server.git.username:访问Git仓库的用户名 +# spring.cloud.config.server.git.password:访问Git仓库的用户密码 + +# 访问配置信息的URL与配置文件的映射关系如下: +# +# /{application}/{profile}[/{label}] +# /{application}-{profile}.yml +# /{label}/{application}-{profile}.yml +# /{application}-{profile}.properties +# /{label}/{application}-{profile}.properties +# +# 上面的 url会映射 {application}-{profile}.properties 对应的配置文件, +# {label}:Git分支,默认为master。{profile}:环境名。 + + diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/pom.xml" b/2-Dalston/consul-client/pom.xml similarity index 60% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/pom.xml" rename to 2-Dalston/consul-client/pom.xml index 467dca3b..6c8e8352 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/pom.xml" +++ b/2-Dalston/consul-client/pom.xml @@ -24,6 +24,20 @@ + + org.springframework.cloud spring-cloud-starter-consul-discovery diff --git a/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java b/2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientApplication.java similarity index 54% rename from Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java rename to 2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientApplication.java index 13dba6a3..971dc490 100644 --- a/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/Application.java +++ b/2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientApplication.java @@ -4,12 +4,12 @@ import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -@EnableDiscoveryClient +@EnableDiscoveryClient // Discovery Client 标识,并会自动化读取相关配置,向服务注册中心发现服务并进行调用。 @SpringBootApplication -public class Application { +public class ConsulClientApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(ConsulClientApplication.class).web(true).run(args); } } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/DcController.java" b/2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientDcController.java similarity index 55% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientDcController.java index 4a90799a..ec29f968 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/DcController.java" +++ b/2-Dalston/consul-client/src/main/java/com/didispace/ConsulClientDcController.java @@ -12,12 +12,17 @@ * @blog http://blog.didispace.com */ @RestController -public class DcController { +public class ConsulClientDcController { @Autowired DiscoveryClient discoveryClient; + // - DiscoveryClient 服务发现客户端,具有以下方法: + // - String description(); 获取描述 + // - ServiceInstance getLocalServiceInstance(); @Deprecated 方法被删除,推荐不要使用。获取本地服务实例 + // - List getInstances(String serviceId); 通过服务 ID,获取当前服务的服务实例 + // - List getServices(); 获取所有服务 ID 列表 - @GetMapping("/dc") + @GetMapping("/consul/client/dc") public String dc() { String services = "Services: " + discoveryClient.getServices(); System.out.println(services); diff --git a/2-Dalston/consul-client/src/main/resources/application.properties b/2-Dalston/consul-client/src/main/resources/application.properties new file mode 100644 index 00000000..7ea5597c --- /dev/null +++ b/2-Dalston/consul-client/src/main/resources/application.properties @@ -0,0 +1,20 @@ +spring.application.name=consul-client +server.port=2002 + +#基于consul服务治理的服务提供者 +spring.cloud.consul.host=localhost +spring.cloud.consul.port=8500 + +# 关闭 健康检查 +management.health.defaults.enabled = false + +#Spring Cloud Consul项目是针对Consul的服务治理实现。 + +# Consul是一个分布式高可用的系统,它包含多个组件,但是作为一个整体,在微服务架构中为我们的基础设施提供服务发现和服务配置的工具。 +# 它包含了下面几个特性: +# 服务发现 +# 健康检查 +# Key/Value存储 +# 多数据中心 + +# 由于 Spring Cloud Consul 项目的实现,我们可以轻松的将基于 Spring Boot 的微服务应用注册到 Consul 上,并通过此实现微服务架构中的服务治理。 diff --git a/2-Dalston/consul-consumer/pom.xml b/2-Dalston/consul-consumer/pom.xml new file mode 100644 index 00000000..4ce895f8 --- /dev/null +++ b/2-Dalston/consul-consumer/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + com.didispace + consul-consumer + 1.0.0 + jar + + consul-consumer + Spring Cloud In Action + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + UTF-8 + 1.8 + + + + + + + org.springframework.cloud + spring-cloud-starter-consul-discovery + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Dalston.SR1 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/Application.java" b/2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerApplication.java similarity index 63% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/Application.java" rename to 2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerApplication.java index 72e9100d..684b61ce 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/Application.java" +++ b/2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerApplication.java @@ -6,9 +6,9 @@ import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; -@EnableDiscoveryClient +@EnableDiscoveryClient // Consul Discovery Client 标识,并会自动化读取 Consul 相关配置,向服务注册中心发现服务并进行调用。 @SpringBootApplication -public class Application { +public class ConsulConsumerApplication { @Bean public RestTemplate restTemplate() { @@ -16,7 +16,7 @@ public RestTemplate restTemplate() { } public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(ConsulConsumerApplication.class).web(true).run(args); } } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/DcController.java" b/2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerDcController.java similarity index 59% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerDcController.java index d258e96f..ec224f76 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/java/com/didispace/DcController.java" +++ b/2-Dalston/consul-consumer/src/main/java/com/didispace/ConsulConsumerDcController.java @@ -1,5 +1,7 @@ package com.didispace; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; @@ -13,18 +15,24 @@ * @blog http://blog.didispace.com */ @RestController -public class DcController { +public class ConsulConsumerDcController { + private static final Logger log = LoggerFactory.getLogger(ConsulConsumerDcController.class); + + // LoadBalanced 是通过 Ribbon 客户端负载均衡去调用服务提供者集群的。 + // 即可以在获取的服务提供者实例列表中,通过 Ribbon 进行选择某实例,然后调用该服务实例。 @Autowired LoadBalancerClient loadBalancerClient; + + // HTTP 访问操作类 @Autowired RestTemplate restTemplate; - @GetMapping("/consumer") + @GetMapping("/consul/consumer/consumer") public String dc() { ServiceInstance serviceInstance = loadBalancerClient.choose("consul-client"); - String url = "http://" + serviceInstance.getHost() + ":" + serviceInstance.getPort() + "/dc"; - System.out.println(url); + String url = "http://" + serviceInstance.getHost() + ":" + serviceInstance.getPort() + "/consul/client/dc"; + log.info("URL : "+url); return restTemplate.getForObject(url, String.class); } diff --git a/2-Dalston/consul-consumer/src/main/resources/application.properties b/2-Dalston/consul-consumer/src/main/resources/application.properties new file mode 100644 index 00000000..06d106ff --- /dev/null +++ b/2-Dalston/consul-consumer/src/main/resources/application.properties @@ -0,0 +1,21 @@ +spring.application.name=consul-consumer +server.port=2102 + +logging.file=${spring.application.name}.log + +#基于consul服务治理的服务提供者 +spring.cloud.consul.host=localhost + +# 关闭 健康检查 +management.health.defaults.enabled = false + +#Spring Cloud Consul项目是针对Consul的服务治理实现。 + +# Consul是一个分布式高可用的系统,它包含多个组件,但是作为一个整体,在微服务架构中为我们的基础设施提供服务发现和服务配置的工具。 +# 它包含了下面几个特性: +# 服务发现 +# 健康检查 +# Key/Value存储 +# 多数据中心 + +#由于Spring Cloud Consul项目的实现,我们可以轻松的将基于Spring Boot的微服务应用注册到Consul上,并通过此实现微服务架构中的服务治理。 \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/pom.xml" b/2-Dalston/eureka-client/pom.xml similarity index 84% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/pom.xml" rename to 2-Dalston/eureka-client/pom.xml index 436115f3..91413352 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/pom.xml" +++ b/2-Dalston/eureka-client/pom.xml @@ -4,11 +4,11 @@ 4.0.0 com.didispace - consul-consumer + eureka-client 1.0.0 jar - consul-consumer + eureka-client Spring Cloud In Action @@ -26,7 +26,7 @@ org.springframework.cloud - spring-cloud-starter-consul-discovery + spring-cloud-starter-eureka @@ -34,10 +34,10 @@ spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-actuator - + + + + diff --git a/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientApplication.java b/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientApplication.java new file mode 100644 index 00000000..89eb39e5 --- /dev/null +++ b/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientApplication.java @@ -0,0 +1,15 @@ +package com.didispace; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@EnableDiscoveryClient // Eureka Discovery Client 标识,并会自动化读取 Eureka 相关配置。还有向服务注册中心发现服务并进行调用。 +@SpringBootApplication +public class EurekaClientApplication { + + public static void main(String[] args) { + new SpringApplicationBuilder(EurekaClientApplication.class).web(true).run(args); + } + +} diff --git a/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientDcController.java b/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientDcController.java new file mode 100644 index 00000000..ce4390b5 --- /dev/null +++ b/2-Dalston/eureka-client/src/main/java/com/didispace/EurekaClientDcController.java @@ -0,0 +1,45 @@ +package com.didispace; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author 翟永超 + * @create 2017/4/15. + * @blog http://blog.didispace.com + */ +@RestController +public class EurekaClientDcController { + private static final Logger logger = LoggerFactory.getLogger(EurekaClientDcController.class); + + @Autowired + DiscoveryClient discoveryClient; + // - DiscoveryClient 服务发现客户端,具有以下方法: + // - String description(); 获取描述 + // - ServiceInstance getLocalServiceInstance(); @Deprecated 方法被删除,推荐不要使用。获取本地服务实例 + // - List getInstances(String serviceId); 通过服务 ID,获取当前服务的服务实例 + // - List getServices(); 获取所有服务 ID 列表 + +/* @GetMapping("/dc") + public String dc() throws InterruptedException{ + // 服务请求超时异常 测试 + Thread.sleep(5000L); + + String services = "Services: " + discoveryClient.getServices(); + System.out.println(services); + return services; + }*/ + + @GetMapping("/eureka/client/dc") + public String dc() { + String services = "Services: " + discoveryClient.getServices(); + logger.info(services); + return services; + } + + +} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/resources/application.properties" b/2-Dalston/eureka-client/src/main/resources/application.properties similarity index 52% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/resources/application.properties" rename to 2-Dalston/eureka-client/src/main/resources/application.properties index 933eeb4c..20186591 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/resources/application.properties" +++ b/2-Dalston/eureka-client/src/main/resources/application.properties @@ -1,17 +1,9 @@ spring.application.name=eureka-client + server.port=2001 eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ + #eureka.client.serviceUrl.defaultZone=http://peer1:1001/eureka/,http://peer2:1002/eureka/ logging.file=${spring.application.name}.log - -#eureka.instance.prefer-ip-address=true - -# -#eureka.client.healthcheck.enabled=true - -# ˿ -#eureka.instance.instance-id=${spring.application.name}:${random.int} -#server.port=0 -#server.port=${random.int[10000,19999]} diff --git a/2-Dalston/eureka-client/src/main/resources/eureka-code-1.png b/2-Dalston/eureka-client/src/main/resources/eureka-code-1.png new file mode 100644 index 00000000..9010fad8 Binary files /dev/null and b/2-Dalston/eureka-client/src/main/resources/eureka-code-1.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/pom.xml" b/2-Dalston/eureka-consumer-feign-hystrix/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/pom.xml" rename to 2-Dalston/eureka-consumer-feign-hystrix/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/Application.java" b/2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/Application.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/Application.java" rename to 2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/Application.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClient.java" b/2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClient.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClient.java" rename to 2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClient.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClientFallback.java" b/2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClientFallback.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClientFallback.java" rename to 2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcClientFallback.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcController.java" b/2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcController.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/eureka-consumer-feign-hystrix/src/main/java/com/didispace/DcController.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/resources/application.properties" b/2-Dalston/eureka-consumer-feign-hystrix/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign-hystrix/src/main/resources/application.properties" rename to 2-Dalston/eureka-consumer-feign-hystrix/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/pom.xml" b/2-Dalston/eureka-consumer-feign/pom.xml similarity index 79% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/pom.xml" rename to 2-Dalston/eureka-consumer-feign/pom.xml index f2822981..d144318e 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/pom.xml" +++ b/2-Dalston/eureka-consumer-feign/pom.xml @@ -28,6 +28,13 @@ org.springframework.cloud spring-cloud-starter-eureka + org.springframework.cloud spring-cloud-starter-feign diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/Application.java" b/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/Application.java similarity index 85% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/Application.java" rename to 2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/Application.java index 96bba90d..2037dd81 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/Application.java" +++ b/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/Application.java @@ -5,6 +5,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; +/*通过@EnableFeignClients注解开启扫描Spring Cloud Feign客户端的功能*/ @EnableFeignClients @EnableDiscoveryClient @SpringBootApplication diff --git a/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java b/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java new file mode 100644 index 00000000..66b345f2 --- /dev/null +++ b/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java @@ -0,0 +1,30 @@ +package com.didispace; + +import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * @author 翟永超 + * @create 2017/6/24. + * @blog http://blog.didispace.com + */ +/** +* 使用@FeignClient注解来指定这个接口所要调用的服务名称,接口中定义的各个函数使用Spring MVC的注解就可以来绑定服务提供方的REST接口 +*/ +@FeignClient("eureka-client") +public interface DcClient { + + @GetMapping("/dc") + String consumer(); + +} +/* +通过Spring Cloud Feign来实现服务调用的方式更加简单了,通过@FeignClient定义的接口来统一的生命我们需要依赖的微服务接口。 + +而在具体使用的时候就跟调用本地方法一点的进行调用即可。 + +由于Feign是基于Ribbon实现的,所以它自带了客户端负载均衡功能,也可以通过Ribbon的IRule进行策略扩展。 + +另外,Feign还整合的Hystrix来实现服务的容错保护,在Dalston版本中,Feign的Hystrix默认是关闭的。 + +*/ \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/DcController.java" b/2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/DcController.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/eureka-consumer-feign/src/main/java/com/didispace/DcController.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/resources/application.properties" b/2-Dalston/eureka-consumer-feign/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/resources/application.properties" rename to 2-Dalston/eureka-consumer-feign/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/pom.xml" b/2-Dalston/eureka-consumer-ribbon-hystrix/pom.xml similarity index 75% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/pom.xml" rename to 2-Dalston/eureka-consumer-ribbon-hystrix/pom.xml index 42287838..342c4193 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/pom.xml" +++ b/2-Dalston/eureka-consumer-ribbon-hystrix/pom.xml @@ -40,10 +40,19 @@ org.springframework.boot spring-boot-starter-actuator + org.springframework.cloud spring-cloud-starter-hystrix + + + org.springframework.cloud + spring-cloud-netflix-hystrix-amqp + diff --git a/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java new file mode 100644 index 00000000..7d069497 --- /dev/null +++ b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java @@ -0,0 +1,72 @@ +package com.didispace; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; + +/**使用 @EnableCircuitBreaker 或 @EnableHystrix 注解开启Hystrix的使用*/ +/**Hystrix具备 服务降级、服务熔断、线程隔离、请求缓存、请求合并以及服务监控 等强大功能。*/ +@EnableCircuitBreaker +@EnableDiscoveryClient +@SpringBootApplication +public class Application { + + @Bean + @LoadBalanced + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + public static void main(String[] args) { + new SpringApplicationBuilder(Application.class).web(true).run(args); + } + +} + +// 可以使用Spring Cloud应用中的 @SpringCloudApplication 注解来修饰应用主类,该注解的具体定义如下所示。 +// 我们可以看到该注解中包含了上我们所引用的三个注解,这也意味着一个Spring Cloud标准应用应包含服务发现以及断路器。 +/* +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@SpringBootApplication +@EnableDiscoveryClient +@EnableCircuitBreaker +public @interface SpringCloudApplication { +}*/ + +/* +断路器的三个重要参数:快照时间窗、请求总数下限、错误百分比下限。 + +这个参数的作用分别是: + + 快照时间窗:断路器确定是否打开需要统计一些请求和错误数据,而统计的时间范围就是快照时间窗,默认为最近的10秒。 + + 请求总数下限:在快照时间窗内,必须满足请求总数下限才有资格根据熔断。 + 默认为20,意味着在10秒内,如果该hystrix命令的调用此时不足20次,即时所有的请求都超时或其他原因失败,断路器都不会打开。 + + 错误百分比下限:当请求总数在快照时间窗内超过了下限, + 比如发生了30次调用,如果在这30次调用中,有16次发生了超时异常,也就是超过50%的错误百分比,在默认设定50%下限情况下,这时候就会将断路器打开。 +*/ + +/* + 那么当断路器打开之后会发生什么呢?我们先来说说断路器未打开之前,对于之前那个示例的情况就是每个请求都会在当hystrix超时之后返回fallback, +每个请求时间延迟就是近似hystrix的超时时间,如果设置为5秒,那么每个请求就都要延迟5秒才会返回。当熔断器在10秒内发现请求总数超过20,并且错误百分比超过50%,这个时候熔断器打开。 +打开之后,再有请求调用的时候,将不会调用主逻辑,而是直接调用降级逻辑,这个时候就不会等待5秒之后才返回fallback。 +通过断路器,实现了自动地发现错误并将降级逻辑切换为主逻辑,减少响应延迟的效果。 + + 在断路器打开之后,处理逻辑并没有结束,我们的降级逻辑已经被成了主逻辑,那么原来的主逻辑要如何恢复呢? +对于这一问题,hystrix也为我们实现了自动恢复功能。当断路器打开,对主逻辑进行熔断之后,hystrix会启动一个休眠时间窗,在这个时间窗内,降级逻辑是临时的成为主逻辑, +当休眠时间窗到期,断路器将进入半开状态,释放一次请求到原来的主逻辑上,如果此次请求正常返回,那么断路器将继续闭合,主逻辑恢复,如果这次请求依然有问题, +断路器继续进入打开状态,休眠时间窗重新计时。 + + 通过上面的一系列机制,hystrix的断路器实现了对依赖资源故障的端口、对降级策略的自动切换以及对主逻辑的自动恢复机制。 +这使得我们的微服务在依赖外部服务或资源的时候得到了非常好的保护,同时对于一些具备降级逻辑的业务需求可以实现自动化的切换与恢复, +相比于设置开关由监控和运维来进行切换的传统实现方式显得更为智能和高效。 + +*/ \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java" b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java similarity index 61% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java index 640d1f15..87f4b82b 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java" +++ b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/DcController.java @@ -1,9 +1,7 @@ package com.didispace; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; -import com.netflix.ribbon.proxy.annotation.Hystrix; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -21,7 +19,7 @@ public class DcController { ConsumerService consumerService; @GetMapping("/consumer") - public String dc() { + public String dc() throws InterruptedException{ return consumerService.consumer(); } @@ -31,15 +29,19 @@ class ConsumerService { @Autowired RestTemplate restTemplate; + // 在为具体执行逻辑的函数上增加 @HystrixCommand 注解来指定服务降级方法 @HystrixCommand(fallbackMethod = "fallback") public String consumer() { return restTemplate.getForObject("http://eureka-client/dc", String.class); } public String fallback() { - return "fallbck"; + return "fallbck:"+"服务请求超时异常测试,服务提供方输出延迟5秒。" + + "服务消费方触发了服务请求超时异常,服务消费者就通过HystrixCommand注解中指定的降级逻辑进行执行,因此该请求的结果返回了fallback。" + + "这样的机制,对自身服务起到了基础的保护,同时还为异常情况提供了自动的服务降级切换机制。"; } } } + diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/resources/application.properties" b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/resources/application.properties" rename to 2-Dalston/eureka-consumer-ribbon-hystrix/src/main/resources/application.properties diff --git a/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/resources/spring-cloud-starter-dalston-5-1-4.png b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/resources/spring-cloud-starter-dalston-5-1-4.png new file mode 100644 index 00000000..6abf3f63 Binary files /dev/null and b/2-Dalston/eureka-consumer-ribbon-hystrix/src/main/resources/spring-cloud-starter-dalston-5-1-4.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/pom.xml" b/2-Dalston/eureka-consumer-ribbon/pom.xml similarity index 66% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/pom.xml" rename to 2-Dalston/eureka-consumer-ribbon/pom.xml index 0ade22cd..75523640 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/pom.xml" +++ b/2-Dalston/eureka-consumer-ribbon/pom.xml @@ -28,6 +28,20 @@ org.springframework.cloud spring-cloud-starter-eureka + + org.springframework.cloud spring-cloud-starter-ribbon diff --git a/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonApplication.java b/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonApplication.java new file mode 100644 index 00000000..876ce458 --- /dev/null +++ b/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonApplication.java @@ -0,0 +1,42 @@ +package com.didispace; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; + +@EnableDiscoveryClient +@SpringBootApplication +public class EurekaConsumerRibbonApplication { + + // HTTP 访问操作类,初始化RestTemplate,用来真正发起REST请求。 + // @LoadBalanced 标志着 RestTemplate 是通过 Ribbon 客户端负载均衡去调用服务提供者集群的。 + // 即可以在获取的服务提供者实例列表中,通过 Ribbon 进行选择某实例,然后调用该服务实例。 + @Bean + @LoadBalanced + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + public static void main(String[] args) { + new SpringApplicationBuilder(EurekaConsumerRibbonApplication.class).web(true).run(args); + } + +} + +/* +Spring Cloud Ribbon 是基于 Netflix Ribbon 实现的一套客户端负载均衡的工具。 +它是一个基于HTTP和TCP的客户端负载均衡器。它可以通过在客户端中配置ribbonServerList来设置服务端列表去轮询访问以达到均衡负载的作用。 + +当Ribbon与Eureka联合使用时,ribbonServerList会被DiscoveryEnabledNIWSServerList重写,扩展成从Eureka注册中心中获取服务实例列表。 +同时它也会用NIWSDiscoveryPing来取代IPing,它将职责委托给Eureka来确定服务端是否已经启动。 + +而当Ribbon与Consul联合使用时,ribbonServerList会被ConsulServerList来扩展成从Consul获取服务实例列表。 +同时由ConsulPing来作为IPing接口的实现。 + +我们在使用 Spring Cloud Ribbon 的时候,不论是与 Eureka 还是 Consul 结合,都会在引入 Spring Cloud Eureka 或 Spring Cloud Consul 依赖的时候通过自动化配置来加载上述所说的配置内容, +所以我们可以快速在Spring Cloud中实现服务间调用的负载均衡。 + +*/ diff --git a/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonDcController.java b/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonDcController.java new file mode 100644 index 00000000..b88d797d --- /dev/null +++ b/2-Dalston/eureka-consumer-ribbon/src/main/java/com/didispace/EurekaConsumerRibbonDcController.java @@ -0,0 +1,24 @@ +package com.didispace; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@RestController +public class EurekaConsumerRibbonDcController { + + @Autowired + RestTemplate restTemplate; + + /* + 对于RestTemplate的使用,我们的第一个url参数有一些特别。这里请求的host位置并没有使用一个具体的IP地址和端口的形式,而是采用了服务名的方式组成。 + 那么这样的请求为什么可以调用成功呢? + 因为Spring Cloud Ribbon有一个拦截器,它能够在这里进行实际调用的时候,自动的去选取服务实例,并将实际要请求的IP地址和端口替换这里的服务名,从而完成服务接口的调用。 + */ + @GetMapping("/eureka/consumer/ribbon/consumer") + public String dc() { + return restTemplate.getForObject("http://eureka-client/eureka/client/dc", String.class); + } + +} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/resources/application.properties" b/2-Dalston/eureka-consumer-ribbon/src/main/resources/application.properties similarity index 63% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/resources/application.properties" rename to 2-Dalston/eureka-consumer-ribbon/src/main/resources/application.properties index 7ccc1a89..49134ffc 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/resources/application.properties" +++ b/2-Dalston/eureka-consumer-ribbon/src/main/resources/application.properties @@ -1,5 +1,5 @@ -spring.application.name=eureka-consumer -server.port=2101 +spring.application.name=eureka-consumer-ribbon +server.port=2103 eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/pom.xml" b/2-Dalston/eureka-consumer/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/pom.xml" rename to 2-Dalston/eureka-consumer/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/Application.java" b/2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerApplication.java similarity index 57% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/Application.java" rename to 2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerApplication.java index 72e9100d..a59fa7db 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/Application.java" +++ b/2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerApplication.java @@ -6,17 +6,18 @@ import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; -@EnableDiscoveryClient +@EnableDiscoveryClient // Eureka Discovery Client 标识,并会自动化读取 Eureka 相关配置。还有向服务注册中心发现服务并进行调用。 @SpringBootApplication -public class Application { +public class EurekaConsumerApplication { + // HTTP 访问操作类,初始化RestTemplate,用来真正发起REST请求。 @Bean public RestTemplate restTemplate() { return new RestTemplate(); } public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(EurekaConsumerApplication.class).web(true).run(args); } } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/DcController.java" b/2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerDcController.java similarity index 54% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/DcController.java" rename to 2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerDcController.java index 42bb5bec..600c1150 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/java/com/didispace/DcController.java" +++ b/2-Dalston/eureka-consumer/src/main/java/com/didispace/EurekaConsumerDcController.java @@ -1,5 +1,7 @@ package com.didispace; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; @@ -7,25 +9,26 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -/** - * @author 翟永超 - * @create 2017/4/15. - * @blog http://blog.didispace.com - */ @RestController -public class DcController { +public class EurekaConsumerDcController { + private static final Logger logger = LoggerFactory.getLogger(EurekaConsumerDcController.class); + + /* + LoadBalanced 是通过 Ribbon 客户端负载均衡去调用服务提供者集群的。 + 即可以在获取的服务提供者实例列表中,通过 Ribbon 进行选择某实例,然后调用该服务实例。 + */ @Autowired LoadBalancerClient loadBalancerClient; + @Autowired - RestTemplate restTemplate; + RestTemplate restTemplate; // HTTP 访问操作类 - @GetMapping("/consumer") + @GetMapping("/eureka/consumer/dc") public String dc() { ServiceInstance serviceInstance = loadBalancerClient.choose("eureka-client"); - String url = "http://" + serviceInstance.getHost() + ":" + serviceInstance.getPort() + "/dc"; - System.out.println(url); + String url = "http://" + serviceInstance.getHost() + ":" + serviceInstance.getPort() + "/eureka/client/dc"; + logger.info("url:"+url); return restTemplate.getForObject(url, String.class); } - } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/resources/application.properties" b/2-Dalston/eureka-consumer/src/main/resources/application.properties similarity index 99% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/resources/application.properties" rename to 2-Dalston/eureka-consumer/src/main/resources/application.properties index 7ccc1a89..1d2990e0 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer/src/main/resources/application.properties" +++ b/2-Dalston/eureka-consumer/src/main/resources/application.properties @@ -1,4 +1,5 @@ spring.application.name=eureka-consumer + server.port=2101 eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-api/pom.xml" b/2-Dalston/eureka-feign-api/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-api/pom.xml" rename to 2-Dalston/eureka-feign-api/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-api/src/main/java/com/didispace/api/HelloService.java" b/2-Dalston/eureka-feign-api/src/main/java/com/didispace/api/HelloService.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-api/src/main/java/com/didispace/api/HelloService.java" rename to 2-Dalston/eureka-feign-api/src/main/java/com/didispace/api/HelloService.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/pom.xml" b/2-Dalston/eureka-feign-client/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/pom.xml" rename to 2-Dalston/eureka-feign-client/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/src/main/java/com/didispace/api/impl/Application.java" b/2-Dalston/eureka-feign-client/src/main/java/com/didispace/api/impl/Application.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/src/main/java/com/didispace/api/impl/Application.java" rename to 2-Dalston/eureka-feign-client/src/main/java/com/didispace/api/impl/Application.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/src/main/resources/application.properties" b/2-Dalston/eureka-feign-client/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-client/src/main/resources/application.properties" rename to 2-Dalston/eureka-feign-client/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/pom.xml" b/2-Dalston/eureka-feign-consumer/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/pom.xml" rename to 2-Dalston/eureka-feign-consumer/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/src/main/java/com/didispace/api/consumer/Application.java" b/2-Dalston/eureka-feign-consumer/src/main/java/com/didispace/api/consumer/Application.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/src/main/java/com/didispace/api/consumer/Application.java" rename to 2-Dalston/eureka-feign-consumer/src/main/java/com/didispace/api/consumer/Application.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/src/main/resources/application.properties" b/2-Dalston/eureka-feign-consumer/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-feign-consumer/src/main/resources/application.properties" rename to 2-Dalston/eureka-feign-consumer/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/pom.xml" b/2-Dalston/eureka-server/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/pom.xml" rename to 2-Dalston/eureka-server/pom.xml diff --git a/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java b/2-Dalston/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java similarity index 72% rename from Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java rename to 2-Dalston/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java index 414607dd..300c2cac 100644 --- a/Chapter1-1-1/eureka-server/src/main/java/com/didispace/Application.java +++ b/2-Dalston/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java @@ -6,10 +6,10 @@ @EnableEurekaServer @SpringBootApplication -public class Application { +public class EurekaServerApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(EurekaServerApplication.class).web(true).run(args); } } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application-peer1.properties" b/2-Dalston/eureka-server/src/main/resources/application-peer1.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application-peer1.properties" rename to 2-Dalston/eureka-server/src/main/resources/application-peer1.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application-peer2.properties" b/2-Dalston/eureka-server/src/main/resources/application-peer2.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application-peer2.properties" rename to 2-Dalston/eureka-server/src/main/resources/application-peer2.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application.properties" b/2-Dalston/eureka-server/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/resources/application.properties" rename to 2-Dalston/eureka-server/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/pom.xml" b/2-Dalston/hystrix-collapser-consumer/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/pom.xml" rename to 2-Dalston/hystrix-collapser-consumer/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/java/com/didispace/Application.java" b/2-Dalston/hystrix-collapser-consumer/src/main/java/com/didispace/Application.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/java/com/didispace/Application.java" rename to 2-Dalston/hystrix-collapser-consumer/src/main/java/com/didispace/Application.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java" b/2-Dalston/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java similarity index 98% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java" rename to 2-Dalston/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java index 7feaba69..9a23ec02 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java" +++ b/2-Dalston/hystrix-collapser-consumer/src/main/java/com/didispace/UserService.java @@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.Future; diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/resources/application.properties" b/2-Dalston/hystrix-collapser-consumer/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/main/resources/application.properties" rename to 2-Dalston/hystrix-collapser-consumer/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/test/java/CollapserTest.java" b/2-Dalston/hystrix-collapser-consumer/src/test/java/CollapserTest.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-consumer/src/test/java/CollapserTest.java" rename to 2-Dalston/hystrix-collapser-consumer/src/test/java/CollapserTest.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/pom.xml" b/2-Dalston/hystrix-collapser-provider/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/pom.xml" rename to 2-Dalston/hystrix-collapser-provider/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/java/com/didispace/Application.java" b/2-Dalston/hystrix-collapser-provider/src/main/java/com/didispace/Application.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/java/com/didispace/Application.java" rename to 2-Dalston/hystrix-collapser-provider/src/main/java/com/didispace/Application.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/java/com/didispace/UserController.java" b/2-Dalston/hystrix-collapser-provider/src/main/java/com/didispace/UserController.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/java/com/didispace/UserController.java" rename to 2-Dalston/hystrix-collapser-provider/src/main/java/com/didispace/UserController.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/resources/application.properties" b/2-Dalston/hystrix-collapser-provider/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/resources/application.properties" rename to 2-Dalston/hystrix-collapser-provider/src/main/resources/application.properties diff --git a/2-Dalston/hystrix-dashboard/pom.xml b/2-Dalston/hystrix-dashboard/pom.xml new file mode 100644 index 00000000..01e21191 --- /dev/null +++ b/2-Dalston/hystrix-dashboard/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.didispace + hystrix-dashboard + 0.0.1-SNAPSHOT + jar + + hystrix-dashboard + + + org.springframework.cloud + spring-cloud-starter-parent + Dalston.SR1 + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.cloud + spring-cloud-starter-hystrix + + + org.springframework.cloud + spring-cloud-starter-hystrix-dashboard + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java" b/2-Dalston/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java similarity index 60% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java" rename to 2-Dalston/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java index d6f8eda9..85e028e2 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java" +++ b/2-Dalston/hystrix-dashboard/src/main/java/com/didispace/HystrixDashboardApplication.java @@ -4,12 +4,13 @@ import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; +/*为应用主类加上@EnableHystrixDashboard,启用 Hystrix Dashboard 功能。*/ @EnableHystrixDashboard @SpringCloudApplication public class HystrixDashboardApplication { - public static void main(String[] args) { - SpringApplication.run(HystrixDashboardApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(HystrixDashboardApplication.class, args); + } } diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/src/main/resources/application.properties" b/2-Dalston/hystrix-dashboard/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/src/main/resources/application.properties" rename to 2-Dalston/hystrix-dashboard/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/pom.xml" b/2-Dalston/pom.xml similarity index 86% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/pom.xml" rename to 2-Dalston/pom.xml index f08ddfa8..c65d760b 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/pom.xml" +++ b/2-Dalston/pom.xml @@ -40,7 +40,13 @@ api-gateway api-gateway-with-eureka - stream-hello + stream-hello-rabbit + + trace-1 + trace-2 + + zipkin-server + zipkin-server-stream diff --git a/2-Dalston/stream-hello-rabbit/pom.xml b/2-Dalston/stream-hello-rabbit/pom.xml new file mode 100644 index 00000000..9f00442b --- /dev/null +++ b/2-Dalston/stream-hello-rabbit/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.didispace + stream-hello-rabbit + 0.0.1-SNAPSHOT + jar + + stream-hello-rabbit + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Dalston.SR4 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/java/com/didispace/stream/SinkApplication.java" b/2-Dalston/stream-hello-rabbit/src/main/java/com/didispace/stream/SinkApplication.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/java/com/didispace/stream/SinkApplication.java" rename to 2-Dalston/stream-hello-rabbit/src/main/java/com/didispace/stream/SinkApplication.java diff --git a/2-Dalston/stream-hello-rabbit/src/main/java/com/didispace/stream/SinkReceiver.java b/2-Dalston/stream-hello-rabbit/src/main/java/com/didispace/stream/SinkReceiver.java new file mode 100644 index 00000000..b1d5518f --- /dev/null +++ b/2-Dalston/stream-hello-rabbit/src/main/java/com/didispace/stream/SinkReceiver.java @@ -0,0 +1,46 @@ +package com.didispace.stream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.stream.annotation.EnableBinding; +import org.springframework.cloud.stream.annotation.StreamListener; +import org.springframework.cloud.stream.messaging.Sink; + +/*创建用于接收来自RabbitMQ消息的消费者SinkReceiver*/ +/*@EnableBinding,该注解用来指定一个或多个定义了@Input或@Output注解的接口,以此实现对消息通道(Channel)的绑定。*/ +/*通过@EnableBinding(Sink.class)绑定了Sink接口,该接口是Spring Cloud Stream中默认实现的对输入消息通道绑定的定义*/ +@EnableBinding(Sink.class) +public class SinkReceiver { + private static Logger logger = LoggerFactory.getLogger(SinkReceiver.class); + /*@StreamListener:该注解主要定义在方法上,作用是将被修饰的方法注册为消息中间件上数据流的事件监听器,注解中的属性值对应了监听的消息通道名。 + 在例子中,我们通过@StreamListener(Sink.INPUT)注解将receive方法注册为对input消息通道的监听处理器, + 所以当我们在RabbitMQ的控制页面中发布消息的时候,receive方法会做出对应的响应动作。*/ + @StreamListener(Sink.INPUT) + public void receive(Object payload) { + logger.info("Received: " + payload.toString()); + } + +} + +/*Sink 接口:实现绑定 input 通道 ;Source 接口:实现绑定 output 通道 ;Processor接口:结合 Sink 和 Source ;*/ +/*当我们需要为 @EnableBinding 指定多个接口来绑定消息通道的时候,可以这样定义:@EnableBinding(value = {Sink.class, Source.class}) */ + +/* +public interface Sink { + String INPUT = "input"; + + @Input(Sink.INPUT) + SubscribableChannel input(); +} +*/ +/* +public interface Source { + String OUTPUT = "output"; + + @Output(Source.OUTPUT) + MessageChannel output(); +} +*/ +/* + public interface Processor extends Source, Sink {} +*/ diff --git a/2-Dalston/stream-hello-rabbit/src/main/resources/SCSt-with-binder.png b/2-Dalston/stream-hello-rabbit/src/main/resources/SCSt-with-binder.png new file mode 100644 index 00000000..39ed5d5c Binary files /dev/null and b/2-Dalston/stream-hello-rabbit/src/main/resources/SCSt-with-binder.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/resources/application.properties" b/2-Dalston/stream-hello-rabbit/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/resources/application.properties" rename to 2-Dalston/stream-hello-rabbit/src/main/resources/application.properties diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/test/java/com/didispace/SinkApplicationTests.java" b/2-Dalston/stream-hello-rabbit/src/test/java/com/didispace/SinkApplicationTests.java similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/test/java/com/didispace/SinkApplicationTests.java" rename to 2-Dalston/stream-hello-rabbit/src/test/java/com/didispace/SinkApplicationTests.java diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/pom.xml" b/2-Dalston/trace-1/pom.xml similarity index 53% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/pom.xml" rename to 2-Dalston/trace-1/pom.xml index 03963e52..03d6b5af 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/pom.xml" +++ b/2-Dalston/trace-1/pom.xml @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent 1.5.10.RELEASE - + @@ -35,27 +35,48 @@ spring-cloud-starter-eureka + + org.springframework.cloud spring-cloud-starter-sleuth - org.springframework.cloud spring-cloud-starter-ribbon - - org.springframework.cloud - spring-cloud-sleuth-zipkin - - + net.logstash.logback logstash-logback-encoder 4.6 + + + + org.springframework.cloud + spring-cloud-sleuth-zipkin + + + + + diff --git a/2-Dalston/trace-1/src/main/java/com/didispace/Trace1Application.java b/2-Dalston/trace-1/src/main/java/com/didispace/Trace1Application.java new file mode 100644 index 00000000..1cd7846c --- /dev/null +++ b/2-Dalston/trace-1/src/main/java/com/didispace/Trace1Application.java @@ -0,0 +1,125 @@ +package com.didispace; + +import org.apache.log4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@RestController +@EnableDiscoveryClient +@SpringBootApplication +public class Trace1Application { + + private final Logger logger = Logger.getLogger(getClass()); + + /* + 在开发调试期间,通常会收集全部跟踪信息输出到远程仓库, + 将其值设置为1, + 或者 + 通过创建 AlwaysSampler 的 Bean(它实现的 isSampled 方法始终返回true)来覆盖默认的 PercentageBasedSampler 策略,比如: + */ + /* + @Bean + public AlwaysSampler defaultSampler() { + return new AlwaysSampler(); + } + */ + + @Bean + @LoadBalanced + RestTemplate restTemplate() { + return new RestTemplate(); + } + + @RequestMapping(value = "/info", method = RequestMethod.GET) + @GetMapping("/info") + public String info() { + logger.info("======"); + return "trace-1,"+restTemplate().getForEntity("http://trace-2/info", String.class).getBody(); + } + + @RequestMapping(value = "/trace-1", method = RequestMethod.GET) + public String trace() { + logger.info("======"); + return restTemplate().getForEntity("http://trace-2/trace-2", String.class).getBody(); + } + + public static void main(String[] args) { + SpringApplication.run(Trace1Application.class, args); + } + +} +/* +-- 日志 +-- trace-1 +INFO [trace-1,f410ab57afd5c145,a9f2118fa2019684,false] 25028 --- [nio-9101-exec-1] ication$$EnhancerBySpringCGLIB$$d8228493 : ====== + +-- trace-2 +INFO [trace-2,f410ab57afd5c145,e9a377dc2268bc29,false] 23112 --- [nio-9102-exec-1] ication$$EnhancerBySpringCGLIB$$e6cb4078 : ====== +*/ + +/* +从上面的控制台输出内容中,我们可以看到多了一些形如[trace-1,f410ab57afd5c145,a9f2118fa2019684,false]的日志信息,而这些元素正是实现分布式服务跟踪的重要组成部分, + +它们每个值的含义如下: + 第一个值:trace-1,它记录了应用的名称,也就是 application.properties 中 spring.application.name 参数配置的属性。 + 第二个值:f410ab57afd5c145,Spring Cloud Sleuth 生成的一个ID,称为 Trace ID,它用来标识一条请求链路。一条请求链路中包含一个 Trace ID,多个 Span ID。 + 第三个值:a9f2118fa2019684,Spring Cloud Sleuth 生成的另外一个ID,称为 Span ID,它表示一个基本的工作单元,比如:发送一个HTTP请求。 + 第四个值:false,表示是否要将该信息输出到 Zipkin 等服务中来收集和展示。 + +上面四个值中的 Trace ID 和 Span ID 是 Spring Cloud Sleuth 实现分布式服务跟踪的核心。 +在一次服务请求链路的调用过程中,会保持并传递同一个 Trace ID,从而将整个分布于不同微服务进程中的请求跟踪信息串联起来, +以上面输出内容为例,trace-1 和 trace-2 同属于一个前端服务请求来源,所以他们的 Trace ID 是相同的,处于同一条请求链路中。 + +在Sleuth中采用了抽象收集的方式来为跟踪信息打上收集标记,第四个boolean类型的值,它代表了该信息是否要被后续的跟踪信息收集器获取和存储。 +*/ + +/* +在工程中引入 spring-cloud-starter-sleuth 依赖之后, 它会自动的为当前应用构建起各通信通道的跟踪机制, +比如: + 通过诸如 RabbitMQ、Kafka(或者其他任何 Spring Cloud Stream 绑定器实现的消息中间件)传递的请求; + 通过 Zuul 代理传递的请求; + 通过 RestTemplate 发起的请求; +*/ + +/* +在Sleuth中的抽样收集策略是通过Sampler接口实现的,它的定义如下: +public interface Sampler { + boolean isSampled(Span span); +} + +通过实现 isSampled 方法,Spring Cloud Sleuth 会在产生跟踪信息的时候调用它来为跟踪信息生成是否要被收集的标志。 +需要注意的是,即使isSampled返回了false,它仅代表该跟踪信息不被输出到后续对接的远程分析系统(比如:Zipkin),对于请求的跟踪活动依然会进行,所以我们在日志中还是能看到收集标识为false的记录。 + +默认情况下,Sleuth 会使用 PercentageBasedSampler 实现的抽样策略,以请求百分比的方式配置和收集跟踪信息, +在 application.properties 中配置下面的参数对其百分比值进行设置,它(跟踪信息取样比例)的默认值为 0.1 ,代表收集 10% 的请求跟踪信息。 + +spring.sleuth.sampler.percentage=0.1 + +在开发调试期间,通常会收集全部跟踪信息输出到远程仓库,我们可以将其值设置为1, +或者也可以通过创建 AlwaysSampler的Bean(它实现的 isSampled 方法始终返回true)来覆盖默认的 PercentageBasedSampler 策略,比如: +@Bean +public AlwaysSampler defaultSampler() { + return new AlwaysSampler(); +} + +在实际使用时,通过与Span对象中存储信息的配合,我们可以根据实际情况做出更贴近需求的抽样策略,比如实现一个仅对包含指定Tag的抽样策略: +public class TagSampler implements Sampler { + private String tag; + public TagSampler(String tag) { + this.tag = tag; + } + @Override + public boolean isSampled(Span span) { + return span.tags().get(tag) != null; + } +} + +*/ \ No newline at end of file diff --git a/2-Dalston/trace-1/src/main/resources/application.properties b/2-Dalston/trace-1/src/main/resources/application.properties new file mode 100644 index 00000000..b1bd68f7 --- /dev/null +++ b/2-Dalston/trace-1/src/main/resources/application.properties @@ -0,0 +1,25 @@ +spring.application.name=trace-1 +server.port=9101 + +eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ + +## spring cloud sleuth 的跟踪信息,收集发送到zipkin,两种方式,选择其中一种时,需要注释不需要的引用,避免冲突。 +# 第一种方式:http方式 ; +# 第二种方式:消息中间件 ; + +## HTTP方式 实现时使用的 spring.zipkin.base-url 参数 +## 如果在zip-server应用中,我们将其端口设置为9411,并且均在本地调试的话,该参数也可以不配置,因为默认值就是http://localhost:9411 + spring.zipkin.base-url=http://localhost:9411 + +## 去掉HTTP方式实现时使用的spring.zipkin.base-url参数,并根据实际部署情况,增加消息中间件的相关配置,比如下面这些关于RabbitMQ的配置信息 +#spring.rabbitmq.host=localhost +#spring.rabbitmq.port=5672 +#spring.rabbitmq.username=springcloud +#spring.rabbitmq.password=123456 + +## 默认情况下,Sleuth 会使用 PercentageBasedSampler 实现的抽样策略,以请求百分比的方式配置和收集跟踪信息,它的默认值为0.1,代表收集10%的请求跟踪信息。 +#spring.sleuth.sampler.percentage=0.1 + +# log trace detail + +#logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG \ No newline at end of file diff --git a/2-Dalston/trace-2/pom.xml b/2-Dalston/trace-2/pom.xml new file mode 100644 index 00000000..f5dcc6b6 --- /dev/null +++ b/2-Dalston/trace-2/pom.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + com.didispace + trace-2 + 0.0.1-SNAPSHOT + jar + + trace-2 + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.10.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.cloud + spring-cloud-starter-eureka + + + + + + org.springframework.cloud + spring-cloud-starter-ribbon + + + + org.springframework.cloud + spring-cloud-starter-sleuth + + + + + net.logstash.logback + logstash-logback-encoder + 4.6 + + + + + + org.springframework.cloud + spring-cloud-sleuth-zipkin + + + + + org.springframework.cloud + spring-cloud-sleuth-stream + + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Dalston.SR5 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/2-Dalston/trace-2/src/main/java/com/didispace/Trace2Application.java b/2-Dalston/trace-2/src/main/java/com/didispace/Trace2Application.java new file mode 100644 index 00000000..be91a07e --- /dev/null +++ b/2-Dalston/trace-2/src/main/java/com/didispace/Trace2Application.java @@ -0,0 +1,55 @@ +package com.didispace; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +@RestController +@EnableDiscoveryClient +@SpringBootApplication +public class Trace2Application { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @RequestMapping(value = "/info", method = RequestMethod.GET) + public String info() { + logger.info("======"); + return "trace-2"; + } + + @RequestMapping(value = "/trace-2", method = RequestMethod.GET) + public String trace(HttpServletRequest request) { + logger.info("======", request.getHeader("X-B3-TraceId"), request.getHeader("X-B3-SpanId")); + return "Trace"; + } + + public static void main(String[] args) { + SpringApplication.run(Trace2Application.class, args); + } +} + +/* +spring-cloud-starter-sleuth 组件会对该请求进行处理,在发送到trace-2之前sleuth会为在该请求的Header中增加实现跟踪需要的重要信息, +主要有下面这几个(通过查看 org.springframework.cloud.sleuth.Span 的源码获取): + X-B3-TraceId:一条请求链路(Trace)的唯一标识,必须值; + X-B3-SpanId:一个工作单元(Span)的唯一标识,必须值; + X-B3-ParentSpanId:标识当前工作单元所属的上一个工作单元,Root Span(请求链路的第一个工作单元)的该值为空; + X-B3-Sampled:是否被抽样输出的标志,1表示需要被输出,0表示不需要被输出; + X-Span-Name:工作单元的名称; +*/ + +/* +基于日志的分析系统,比如:ELK平台,它可以轻松的帮助我们来收集和存储这些跟踪日志,同时在需要的时候我们也可以根据Trace ID来轻松地搜索出对应请求链路相关的明细日志。 + +ELK平台主要有由 ElasticSearch、Logstash 和 Kiabana 三个开源免费工具组成: + Elasticsearch 是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等。 + Logstash 是一个完全开源的工具,他可以对你的日志进行收集、过滤,并将其存储供以后使用。 + Kibana 也是一个开源和免费的工具,它Kibana可以为 Logstash 和 ElasticSearch 提供的日志分析友好的 Web 界面,可以帮助您汇总、分析和搜索重要数据日志。 +*/ \ No newline at end of file diff --git a/2-Dalston/trace-2/src/main/resources/application.properties b/2-Dalston/trace-2/src/main/resources/application.properties new file mode 100644 index 00000000..94f8fc73 --- /dev/null +++ b/2-Dalston/trace-2/src/main/resources/application.properties @@ -0,0 +1,25 @@ +spring.application.name=trace-2 +server.port=9102 + +eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ + +## spring cloud sleuth 的跟踪信息,收集发送到zipkin,两种方式,选择其中一种时,需要注释不需要的引用,避免冲突。 +# 第一种方式:http方式 ; +# 第二种方式:消息中间件 ; + +## 第一种方式:HTTP方式 实现时使用的 spring.zipkin.base-url 参数 +## 如果在zip-server应用中,我们将其端口设置为9411,并且均在本地调试的话,该参数也可以不配置,因为默认值就是http://localhost:9411 + spring.zipkin.base-url=http://localhost:9411 + +# 第二种方式:消息中间件 的相关配置,比如下面这些关于RabbitMQ的配置信息 +#spring.rabbitmq.host=localhost +#spring.rabbitmq.port=5672 +#spring.rabbitmq.username=springcloud +#spring.rabbitmq.password=123456 + +## 默认情况下,Sleuth 会使用 PercentageBasedSampler 实现的抽样策略,以请求百分比的方式配置和收集跟踪信息,它的默认值为0.1,代表收集10%的请求跟踪信息。 +#spring.sleuth.sampler.percentage=0.5 + +## log trace detail + +#logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG \ No newline at end of file diff --git a/2-Dalston/trace-2/src/main/resources/bootstrap.properties b/2-Dalston/trace-2/src/main/resources/bootstrap.properties new file mode 100644 index 00000000..e2be39cc --- /dev/null +++ b/2-Dalston/trace-2/src/main/resources/bootstrap.properties @@ -0,0 +1 @@ +spring.application.name=trace-1 \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/logback-spring.xml" b/2-Dalston/trace-2/src/main/resources/logback-spring.xml similarity index 76% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/logback-spring.xml" rename to 2-Dalston/trace-2/src/main/resources/logback-spring.xml index a0551eee..929326c1 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/logback-spring.xml" +++ b/2-Dalston/trace-2/src/main/resources/logback-spring.xml @@ -3,13 +3,15 @@ - + + ​ + - + @@ -22,19 +24,21 @@ ​ - - - - - - - - - - - + ​ - + ${LOG_FILE}.json @@ -44,7 +48,7 @@ - UTC + UTC+8 @@ -70,4 +74,5 @@ + \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/pom.xml" b/2-Dalston/turbine-amqp/pom.xml similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/pom.xml" rename to 2-Dalston/turbine-amqp/pom.xml diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java" b/2-Dalston/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java similarity index 85% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java" rename to 2-Dalston/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java index e4cd0209..faf3dfae 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java" +++ b/2-Dalston/turbine-amqp/src/main/java/com/didispace/TurbineApplication.java @@ -17,3 +17,5 @@ public static void main(String[] args) { } } + +/* 在应用主类中使用 @EnableTurbineStream 注解来启用 Turbine Stream 的配置。*/ \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/resources/application.properties" b/2-Dalston/turbine-amqp/src/main/resources/application.properties similarity index 97% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/resources/application.properties" rename to 2-Dalston/turbine-amqp/src/main/resources/application.properties index 8ae292e2..c986e94b 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine-amqp/src/main/resources/application.properties" +++ b/2-Dalston/turbine-amqp/src/main/resources/application.properties @@ -3,4 +3,4 @@ spring.application.name=turbine-amqp server.port=8989 management.port=8990 -eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ \ No newline at end of file +eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ diff --git a/2-Dalston/turbine-amqp/src/main/resources/spring-cloud-starter-dalston-5-2-3.png b/2-Dalston/turbine-amqp/src/main/resources/spring-cloud-starter-dalston-5-2-3.png new file mode 100644 index 00000000..16a65eef Binary files /dev/null and b/2-Dalston/turbine-amqp/src/main/resources/spring-cloud-starter-dalston-5-2-3.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/pom.xml" b/2-Dalston/turbine/pom.xml similarity index 90% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/pom.xml" rename to 2-Dalston/turbine/pom.xml index 4e6d77ef..6f5e796e 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/pom.xml" +++ b/2-Dalston/turbine/pom.xml @@ -9,6 +9,7 @@ jar turbine + 对服务的Hystrix数据进行聚合展示 org.springframework.cloud @@ -24,6 +25,7 @@ + org.springframework.cloud spring-cloud-starter-turbine diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/java/com/didispace/TurbineApplication.java" b/2-Dalston/turbine/src/main/java/com/didispace/TurbineApplication.java similarity index 92% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/java/com/didispace/TurbineApplication.java" rename to 2-Dalston/turbine/src/main/java/com/didispace/TurbineApplication.java index 99556459..516e6678 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/java/com/didispace/TurbineApplication.java" +++ b/2-Dalston/turbine/src/main/java/com/didispace/TurbineApplication.java @@ -8,6 +8,7 @@ @Configuration @EnableAutoConfiguration +/*使用@EnableTurbine注解开启Turbine*/ @EnableTurbine @EnableDiscoveryClient public class TurbineApplication { diff --git a/2-Dalston/turbine/src/main/resources/application.properties b/2-Dalston/turbine/src/main/resources/application.properties new file mode 100644 index 00000000..3c6aca32 --- /dev/null +++ b/2-Dalston/turbine/src/main/resources/application.properties @@ -0,0 +1,20 @@ +spring.application.name=turbine + +server.port=8989 +management.port=8990 + +eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ + +turbine.app-config=eureka-consumer-ribbon-hystrix +turbine.cluster-name-expression="default" +turbine.combine-host-port=true + +#参数说明 +# +#turbine.app-config 参数指定了需要收集监控信息的服务名; + +#turbine.cluster-name-expression 参数指定了集群名称为default,当我们服务数量非常多的时候,可以启动多个Turbine服务来构建不同的聚合集群, +# 而该参数可以用来区分这些不同的聚合集群,同时该参数值可以在Hystrix仪表盘中用来定位不同的聚合集群,只需要在Hystrix Stream的URL中通过cluster参数来指定; + +#turbine.combine-host-port 参数设置为true,可以让同一主机上的服务通过主机名与端口号的组合来进行区分, +# 默认情况下会以host来区分不同的服务,这会使得在本地调试的时候,本机上的不同服务聚合成一个服务来统计。 \ No newline at end of file diff --git a/2-Dalston/turbine/src/main/resources/spring-cloud-starter-dalston-5-2-2.png b/2-Dalston/turbine/src/main/resources/spring-cloud-starter-dalston-5-2-2.png new file mode 100644 index 00000000..e5489e4d Binary files /dev/null and b/2-Dalston/turbine/src/main/resources/spring-cloud-starter-dalston-5-2-2.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/pom.xml" b/2-Dalston/zipkin-server-stream/pom.xml similarity index 67% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/pom.xml" rename to 2-Dalston/zipkin-server-stream/pom.xml index 532d98a3..06ff5156 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/pom.xml" +++ b/2-Dalston/zipkin-server-stream/pom.xml @@ -24,7 +24,14 @@ 1.8 + + org.springframework.cloud spring-cloud-sleuth-zipkin-stream diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java" b/2-Dalston/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java similarity index 76% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java" rename to 2-Dalston/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java index 14b2f49a..a9188172 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java" +++ b/2-Dalston/zipkin-server-stream/src/main/java/com/didispace/ZipkinApplication.java @@ -3,10 +3,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer; -import org.springframework.context.annotation.Bean; -import zipkin.server.EnableZipkinServer; -import zipkin.storage.SpanStore; +/*用消息代理收集,@EnableZipkinStreamServer注解*/ @EnableZipkinStreamServer @SpringBootApplication public class ZipkinApplication { diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/resources/application.properties" b/2-Dalston/zipkin-server-stream/src/main/resources/application.properties similarity index 65% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/resources/application.properties" rename to 2-Dalston/zipkin-server-stream/src/main/resources/application.properties index 280898fe..1c1e532e 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server-stream/src/main/resources/application.properties" +++ b/2-Dalston/zipkin-server-stream/src/main/resources/application.properties @@ -1,11 +1,12 @@ spring.application.name=zipkin-server-stream server.port=9411 +# ϢмãЩRabbitMQϢ spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=springcloud spring.rabbitmq.password=123456 -#eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ +#eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ logging.file=${spring.application.name}.log \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/pom.xml" b/2-Dalston/zipkin-server/pom.xml similarity index 89% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/pom.xml" rename to 2-Dalston/zipkin-server/pom.xml index 28c0a609..b445b4f0 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/pom.xml" +++ b/2-Dalston/zipkin-server/pom.xml @@ -24,6 +24,8 @@ 1.8 + + io.zipkin.java @@ -33,6 +35,7 @@ io.zipkin.java zipkin-autoconfigure-ui + diff --git a/2-Dalston/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java b/2-Dalston/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java new file mode 100644 index 00000000..205311c8 --- /dev/null +++ b/2-Dalston/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java @@ -0,0 +1,37 @@ +package com.didispace; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import zipkin.server.EnableZipkinServer; + +/*用http方式收集,使用 @EnableZipkinServer 注解来启动Zipkin Server*/ +@EnableZipkinServer +@SpringBootApplication +public class ZipkinApplication { + + public static void main(String[] args) { + SpringApplication.run(ZipkinApplication.class, args); + } + +} +/* +我们虽然已经能够利用ELK平台提供的收集、存储、搜索等强大功能,对跟踪信息的管理和使用已经变得非常便利。 +但是,在ELK平台中的数据分析维度缺少对请求链路中各阶段时间延迟的关注,很多时候我们追溯请求链路的一个原因是为了找出整个调用链路中出现延迟过高的瓶颈源, +亦或是为了实现对分布式系统做延迟监控等与时间消耗相关的需求,这时候类似ELK这样的日志分析系统就显得有些乏力了。 +对于这样的问题,我们就可以引入 Zipkin 来得以轻松解决。 +*/ + +/* +Zipkin是Twitter的一个开源项目,它基于Google Dapper实现。 +我们可以使用它来收集各个服务器上请求链路的跟踪数据,并通过它提供的REST API接口来辅助我们查询跟踪数据以实现对分布式系统的监控程序,从而及时地发现系统中出现的延迟升高问题并找出系统性能瓶颈的根源。 +除了面向开发的API接口之外,它也提供了方便的UI组件来帮助我们直观的搜索跟踪信息和分析请求链路明细,比如:可以查询某段时间内各用户请求的处理时间等。 +*/ + +/* +Zipkin 的基础架构,它主要有4个核心组件构成: + Collector:收集器组件,它主要用于处理从外部系统发送过来的跟踪信息,将这些信息转换为Zipkin内部处理的Span格式,以支持后续的存储、分析、展示等功能。 + Storage:存储组件,它主要对处理收集器接收到的跟踪信息,默认会将这些信息存储在内存中,我们也可以修改此存储策略,通过使用其他存储组件将跟踪信息存储到数据库中。 + RESTful API:API组件,它主要用来提供外部访问接口。比如给客户端展示跟踪信息,或是外接系统访问以实现监控等。 + Web UI:UI组件,基于API组件实现的上层应用。通过UI组件用户可以方便而有直观地查询和分析跟踪信息。 +*/ + diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/src/main/resources/application.properties" b/2-Dalston/zipkin-server/src/main/resources/application.properties similarity index 100% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/src/main/resources/application.properties" rename to 2-Dalston/zipkin-server/src/main/resources/application.properties diff --git a/2-Dalston/zipkin-server/src/main/resources/zipkin-architecture.png b/2-Dalston/zipkin-server/src/main/resources/zipkin-architecture.png new file mode 100644 index 00000000..60592238 Binary files /dev/null and b/2-Dalston/zipkin-server/src/main/resources/zipkin-architecture.png differ diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java" deleted file mode 100644 index b9a4f478..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway-with-eureka/src/main/java/com/didispace/AccessFilter.java" +++ /dev/null @@ -1,47 +0,0 @@ -package com.didispace; - -import com.netflix.zuul.ZuulFilter; -import com.netflix.zuul.context.RequestContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; - -public class AccessFilter extends ZuulFilter { - - private static Logger log = LoggerFactory.getLogger(AccessFilter.class); - - @Override - public String filterType() { - return "pre"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - RequestContext ctx = RequestContext.getCurrentContext(); - HttpServletRequest request = ctx.getRequest(); - - log.info("send {} request to {}", request.getMethod(), request.getRequestURL().toString()); - - Object accessToken = request.getParameter("accessToken"); - if(accessToken == null) { - log.warn("access token is empty"); - ctx.setSendZuulResponse(false); - ctx.setResponseStatusCode(401); - return null; - } - log.info("access token ok"); - return null; - } - -} \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/java/com/didispace/Application.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/java/com/didispace/Application.java" deleted file mode 100644 index 225959c6..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/java/com/didispace/Application.java" +++ /dev/null @@ -1,15 +0,0 @@ -package com.didispace; - -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.SpringCloudApplication; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; - -@EnableZuulProxy -@SpringCloudApplication -public class Application { - - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/resources/application.yaml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/resources/application.yaml" deleted file mode 100644 index 70865f2a..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/api-gateway/src/main/resources/application.yaml" +++ /dev/null @@ -1,21 +0,0 @@ -spring: - application: - name: api-gateway - -server: - port: 1101 - -zuul: - routes: -# single-instance - api-a: - path: /api-a/** - url: http://localhost:2001/ -# multi-instance - api-b: - path: /api-b/** - serviceId: api-b - -api-b: - ribbon: - listOfServers: http://localhost:2001/, http://localhost:2002/ \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/resources/bootstrap.yml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/resources/bootstrap.yml" deleted file mode 100644 index 0d92aeb9..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-client/src/main/resources/bootstrap.yml" +++ /dev/null @@ -1,12 +0,0 @@ -spring: - application: - name: config-client - cloud: - config: - uri: http://localhost:1201/ - profile: default - label: master - -server: - port: 2001 - diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/java/com/didispace/Application.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/java/com/didispace/Application.java" deleted file mode 100644 index a2e140c3..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/java/com/didispace/Application.java" +++ /dev/null @@ -1,15 +0,0 @@ -package com.didispace; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.config.server.EnableConfigServer; - -@EnableConfigServer -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/resources/application.yml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/resources/application.yml" deleted file mode 100644 index c3154087..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/config-server-git/src/main/resources/application.yml" +++ /dev/null @@ -1,14 +0,0 @@ -spring: - application: - name: config-server - cloud: - config: - server: - git: - uri: http://git.oschina.net/didispace/config-repo-demo/ -# search-paths: repo -# username: -# password: - -server: - port: 1201 diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/java/com/didispace/DcController.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/java/com/didispace/DcController.java" deleted file mode 100644 index 4a90799a..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/java/com/didispace/DcController.java" +++ /dev/null @@ -1,27 +0,0 @@ -package com.didispace; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.client.discovery.DiscoveryClient; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author 翟永超 - * @create 2017/4/15. - * @blog http://blog.didispace.com - */ -@RestController -public class DcController { - - @Autowired - DiscoveryClient discoveryClient; - - @GetMapping("/dc") - public String dc() { - String services = "Services: " + discoveryClient.getServices(); - System.out.println(services); - return services; - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/resources/application.properties" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/resources/application.properties" deleted file mode 100644 index 1e9d1d4c..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-client/src/main/resources/application.properties" +++ /dev/null @@ -1,5 +0,0 @@ -spring.application.name=consul-client -server.port=2001 - -spring.cloud.consul.host=localhost -spring.cloud.consul.port=8500 diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/resources/application.properties" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/resources/application.properties" deleted file mode 100644 index 95c1be20..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/consul-consumer/src/main/resources/application.properties" +++ /dev/null @@ -1,7 +0,0 @@ -spring.application.name=consul-consumer -server.port=2101 - -spring.cloud.consul.host=localhost -spring.cloud.consul.port=8500 - -logging.file=${spring.application.name}.log diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/pom.xml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/pom.xml" deleted file mode 100644 index 24400c25..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/pom.xml" +++ /dev/null @@ -1,64 +0,0 @@ - - - 4.0.0 - - com.didispace - eureka-client - 1.0.0 - jar - - eureka-client - Spring Cloud In Action - - - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE - - - - - UTF-8 - 1.8 - - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - org.springframework.boot - spring-boot-starter-web - - - - - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR1 - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/Application.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/Application.java" deleted file mode 100644 index 13dba6a3..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-client/src/main/java/com/didispace/Application.java" +++ /dev/null @@ -1,15 +0,0 @@ -package com.didispace; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; - -@EnableDiscoveryClient -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java" deleted file mode 100644 index cecb9745..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-feign/src/main/java/com/didispace/DcClient.java" +++ /dev/null @@ -1,17 +0,0 @@ -package com.didispace; - -import org.springframework.cloud.netflix.feign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * @author 翟永超 - * @create 2017/6/24. - * @blog http://blog.didispace.com - */ -@FeignClient("eureka-client") -public interface DcClient { - - @GetMapping("/dc") - String consumer(); - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java" deleted file mode 100644 index 690fa594..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon-hystrix/src/main/java/com/didispace/Application.java" +++ /dev/null @@ -1,27 +0,0 @@ -package com.didispace; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.cloud.netflix.hystrix.EnableHystrix; -import org.springframework.context.annotation.Bean; -import org.springframework.web.client.RestTemplate; - -@EnableCircuitBreaker -@EnableDiscoveryClient -@SpringBootApplication -public class Application { - - @Bean - @LoadBalanced - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/Application.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/Application.java" deleted file mode 100644 index 2cc33e07..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/Application.java" +++ /dev/null @@ -1,24 +0,0 @@ -package com.didispace; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.web.client.RestTemplate; - -@EnableDiscoveryClient -@SpringBootApplication -public class Application { - - @Bean - @LoadBalanced - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/DcController.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/DcController.java" deleted file mode 100644 index 297fe844..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-consumer-ribbon/src/main/java/com/didispace/DcController.java" +++ /dev/null @@ -1,24 +0,0 @@ -package com.didispace; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.RestTemplate; - -/** - * @author 翟永超 - * @create 2017/4/15. - * @blog http://blog.didispace.com - */ -@RestController -public class DcController { - - @Autowired - RestTemplate restTemplate; - - @GetMapping("/consumer") - public String dc() { - return restTemplate.getForObject("http://eureka-client/dc", String.class); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/pom.xml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/pom.xml" deleted file mode 100644 index 487b8271..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-dashboard/pom.xml" +++ /dev/null @@ -1,50 +0,0 @@ - - - 4.0.0 - - com.didispace - hystrix-dashboard - 0.0.1-SNAPSHOT - jar - - hystrix-dashboard - - - org.springframework.cloud - spring-cloud-starter-parent - Dalston.SR1 - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.cloud - spring-cloud-starter-hystrix - - - org.springframework.cloud - spring-cloud-starter-hystrix-dashboard - - - org.springframework.boot - spring-boot-starter-actuator - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/pom.xml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/pom.xml" deleted file mode 100644 index e89263aa..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/pom.xml" +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.didispace - stream-hello - 0.0.1-SNAPSHOT - jar - - stream-hello - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR4 - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/java/com/didispace/stream/SinkReceiver.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/java/com/didispace/stream/SinkReceiver.java" deleted file mode 100644 index 7f869b61..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/stream-hello/src/main/java/com/didispace/stream/SinkReceiver.java" +++ /dev/null @@ -1,19 +0,0 @@ -package com.didispace.stream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.cloud.stream.annotation.EnableBinding; -import org.springframework.cloud.stream.annotation.StreamListener; -import org.springframework.cloud.stream.messaging.Sink; - -@EnableBinding(Sink.class) -public class SinkReceiver { - - private static Logger logger = LoggerFactory.getLogger(SinkReceiver.class); - - @StreamListener(Sink.INPUT) - public void receive(Object payload) { - logger.info("Received: " + payload); - } - -} \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/java/com/didispace/TraceApplication.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/java/com/didispace/TraceApplication.java" deleted file mode 100644 index 31be0490..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/java/com/didispace/TraceApplication.java" +++ /dev/null @@ -1,42 +0,0 @@ -package com.didispace; - -import org.apache.log4j.Logger; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.RestTemplate; - -@RestController -@EnableDiscoveryClient -@SpringBootApplication -public class TraceApplication { - - private final Logger logger = Logger.getLogger(getClass()); - -// @Bean -// public AlwaysSampler defaultSampler() { -// return new AlwaysSampler(); -// } - - @Bean - @LoadBalanced - RestTemplate restTemplate() { - return new RestTemplate(); - } - - @RequestMapping(value = "/trace-1", method = RequestMethod.GET) - public String trace() { - logger.info("======"); - return restTemplate().getForEntity("http://trace-2/trace-2", String.class).getBody(); - } - - public static void main(String[] args) { - SpringApplication.run(TraceApplication.class, args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/resources/application.properties" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/resources/application.properties" deleted file mode 100644 index 58d4d826..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-1/src/main/resources/application.properties" +++ /dev/null @@ -1,11 +0,0 @@ -spring.application.name=trace-1 -server.port=9101 - -eureka.client.serviceUrl.defaultZone=http://eureka.didispace.com/eureka/ - -#spring.zipkin.base-url=http://localhost:9411 - -#spring.sleuth.sampler.percentage=0.1 - -# log trace detail -#logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/pom.xml" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/pom.xml" deleted file mode 100644 index b30ba5d0..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/pom.xml" +++ /dev/null @@ -1,82 +0,0 @@ - - - 4.0.0 - - com.didispace - trace-2 - 0.0.1-SNAPSHOT - jar - - trace-2 - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.10.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - org.springframework.cloud - spring-cloud-starter-ribbon - - - - org.springframework.cloud - spring-cloud-starter-sleuth - - - - net.logstash.logback - logstash-logback-encoder - 4.6 - - - - org.springframework.cloud - spring-cloud-sleuth-zipkin - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Dalston.SR5 - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/java/com/didispace/TraceApplication.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/java/com/didispace/TraceApplication.java" deleted file mode 100644 index 559f1895..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/java/com/didispace/TraceApplication.java" +++ /dev/null @@ -1,32 +0,0 @@ -package com.didispace; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; - -@RestController -@EnableDiscoveryClient -@SpringBootApplication -public class TraceApplication { - - private final Logger logger = LoggerFactory.getLogger(getClass()); - - @RequestMapping(value = "/trace-2", method = RequestMethod.GET) - public String trace(HttpServletRequest request) { - logger.info("======", - request.getHeader("X-B3-TraceId"), request.getHeader("X-B3-SpanId")); - return "Trace"; - } - - public static void main(String[] args) { - SpringApplication.run(TraceApplication.class, args); - } - -} diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/application.properties" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/application.properties" deleted file mode 100644 index 9487296a..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/trace-2/src/main/resources/application.properties" +++ /dev/null @@ -1,11 +0,0 @@ -spring.application.name=trace-2 -server.port=9102 - -eureka.client.serviceUrl.defaultZone=http://eureka.didispace.com/eureka/ - -#spring.zipkin.base-url=http://localhost:9411 -# -#spring.sleuth.sampler.percentage=0.5 -# -## log trace detail -#logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/resources/application.properties" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/resources/application.properties" deleted file mode 100644 index 8367f619..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/turbine/src/main/resources/application.properties" +++ /dev/null @@ -1,10 +0,0 @@ -spring.application.name=turbine - -server.port=8989 -management.port=8990 - -eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/ - -turbine.app-config=eureka-consumer-ribbon-hystrix -turbine.cluster-name-expression="default" -turbine.combine-host-port=true \ No newline at end of file diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java" "b/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java" deleted file mode 100644 index 011680d5..00000000 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/zipkin-server/src/main/java/com/didispace/ZipkinApplication.java" +++ /dev/null @@ -1,15 +0,0 @@ -package com.didispace; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import zipkin.server.EnableZipkinServer; - -@EnableZipkinServer -@SpringBootApplication -public class ZipkinApplication { - - public static void main(String[] args) { - SpringApplication.run(ZipkinApplication.class, args); - } - -} diff --git a/Chapter1-1-1/compute-service/pom.xml b/Chapter1-1-1/compute-service/pom.xml index 04ef83d0..1334ec99 100644 --- a/Chapter1-1-1/compute-service/pom.xml +++ b/Chapter1-1-1/compute-service/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.5.4.RELEASE @@ -42,7 +42,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + Dalston.SR1 pom import diff --git a/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java b/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java deleted file mode 100644 index a2f42803..00000000 --- a/Chapter1-1-1/compute-service/src/test/java/com/didispace/ApplicationTests.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.didispace; - -import com.didispace.web.ComputeController; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.SpringApplicationConfiguration; -import org.springframework.http.MediaType; -import org.springframework.mock.web.MockServletContext; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -import static org.hamcrest.Matchers.equalTo; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = MockServletContext.class) -@WebAppConfiguration -public class ApplicationTests { - - private MockMvc mvc; - - @Before - public void setUp() throws Exception { - mvc = MockMvcBuilders.standaloneSetup(new ComputeController()).build(); - } - - @Test - public void getHello() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(equalTo("Hello World"))); - } - -} diff --git a/Chapter1-1-1/eureka-server/pom.xml b/Chapter1-1-1/eureka-server/pom.xml index 3f01c311..31e3a6ee 100644 --- a/Chapter1-1-1/eureka-server/pom.xml +++ b/Chapter1-1-1/eureka-server/pom.xml @@ -12,10 +12,10 @@ Spring Cloud project - org.springframework.boot - spring-boot-starter-parent - 1.3.5.RELEASE - + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + @@ -43,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + Dalston.SR1 pom import diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/java/com/didispace/Application.java" b/Chapter1-1-1/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java similarity index 72% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/java/com/didispace/Application.java" rename to Chapter1-1-1/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java index 414607dd..300c2cac 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/eureka-server/src/main/java/com/didispace/Application.java" +++ b/Chapter1-1-1/eureka-server/src/main/java/com/didispace/EurekaServerApplication.java @@ -6,10 +6,10 @@ @EnableEurekaServer @SpringBootApplication -public class Application { +public class EurekaServerApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(EurekaServerApplication.class).web(true).run(args); } } diff --git a/Chapter1-1-1/eureka-server/src/main/resources/application.properties b/Chapter1-1-1/eureka-server/src/main/resources/application.properties index 8dad7230..3546d063 100644 --- a/Chapter1-1-1/eureka-server/src/main/resources/application.properties +++ b/Chapter1-1-1/eureka-server/src/main/resources/application.properties @@ -1,6 +1,12 @@ -server.port=1111 +#server.port=1111 #eureka.instance.hostname=localhost +# +#eureka.client.register-with-eureka=false +#eureka.client.fetch-registry=false +#eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ +spring.application.name=eureka-server +server.port=1111 +eureka.instance.hostname=localhost eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false -eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ \ No newline at end of file +eureka.client.fetch-registry=false \ No newline at end of file diff --git a/Chapter1-1-4/config-server/pom.xml b/Chapter1-1-4/config-server/pom.xml index 379aa99d..5307a3a4 100644 --- a/Chapter1-1-4/config-server/pom.xml +++ b/Chapter1-1-4/config-server/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.5.RELEASE + 1.5.4.RELEASE @@ -43,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.RELEASE + Dalston.SR1 pom import diff --git a/Chapter1-1-4/config-server/src/main/resources/application.properties b/Chapter1-1-4/config-server/src/main/resources/application.properties index 4157fdd4..0621f240 100644 --- a/Chapter1-1-4/config-server/src/main/resources/application.properties +++ b/Chapter1-1-4/config-server/src/main/resources/application.properties @@ -2,10 +2,10 @@ spring.application.name=config-server server.port=7001 # git -spring.cloud.config.server.git.uri=http://git.oschina.net/didispace/SpringBoot-Learning/ -spring.cloud.config.server.git.searchPaths=Chapter9-1-4/config-repo -spring.cloud.config.server.git.username=username -spring.cloud.config.server.git.password=password +spring.cloud.config.server.git.uri=https://gitee.com/pdb2010/config-server +#spring.cloud.config.server.git.searchPaths=Chapter9-1-4/config-repo +spring.cloud.config.server.git.username=pangdabo2010@hotmail.com +spring.cloud.config.server.git.password=ZXCVbnm.123 # spring.profiles.active=native diff --git a/Chapter1-1-7/config-client-eureka-kafka/pom.xml b/Chapter1-1-7/config-client-eureka-kafka/pom.xml index 16e6424d..26418a7a 100644 --- a/Chapter1-1-7/config-client-eureka-kafka/pom.xml +++ b/Chapter1-1-7/config-client-eureka-kafka/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.7.RELEASE + 1.5.4.RELEASE @@ -59,7 +59,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.SR5 + Dalston.SR1 pom import diff --git "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/java/com/didispace/Application.java" b/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/ConfigClientEurekaKafkaApplication.java similarity index 69% rename from "2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/java/com/didispace/Application.java" rename to Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/ConfigClientEurekaKafkaApplication.java index 13dba6a3..03241f41 100644 --- "a/2-Dalston\347\211\210\346\225\231\347\250\213\347\244\272\344\276\213/hystrix-collapser-provider/src/main/java/com/didispace/Application.java" +++ b/Chapter1-1-7/config-client-eureka-kafka/src/main/java/com/didispace/ConfigClientEurekaKafkaApplication.java @@ -6,10 +6,10 @@ @EnableDiscoveryClient @SpringBootApplication -public class Application { +public class ConfigClientEurekaKafkaApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(ConfigClientEurekaKafkaApplication.class).web(true).run(args); } } diff --git a/Chapter1-1-7/config-server-eureka-kafka/pom.xml b/Chapter1-1-7/config-server-eureka-kafka/pom.xml index 9bcdcb68..0cda969b 100644 --- a/Chapter1-1-7/config-server-eureka-kafka/pom.xml +++ b/Chapter1-1-7/config-server-eureka-kafka/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.7.RELEASE + 1.5.4.RELEASE @@ -43,7 +43,7 @@ org.springframework.cloud spring-cloud-dependencies - Brixton.SR5 + Dalston.SR1 pom import diff --git a/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java b/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/ConfigServerEurekaKafkaApplication.java similarity index 74% rename from Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java rename to Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/ConfigServerEurekaKafkaApplication.java index d728543c..414a6fce 100644 --- a/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/Application.java +++ b/Chapter1-1-7/config-server-eureka-kafka/src/main/java/com/didispace/ConfigServerEurekaKafkaApplication.java @@ -8,10 +8,10 @@ @EnableDiscoveryClient @EnableConfigServer @SpringBootApplication -public class Application { +public class ConfigServerEurekaKafkaApplication { public static void main(String[] args) { - new SpringApplicationBuilder(Application.class).web(true).run(args); + new SpringApplicationBuilder(ConfigServerEurekaKafkaApplication.class).web(true).run(args); } } diff --git a/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties b/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties index 6caa7ecd..1032fef0 100644 --- a/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties +++ b/Chapter1-1-7/config-server-eureka-kafka/src/main/resources/application.properties @@ -4,11 +4,16 @@ server.port=7001 eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ # git -spring.cloud.config.server.git.uri=http://git.oschina.net/didispace/SpringCloud-Learning/ -spring.cloud.config.server.git.searchPaths=Chapter1-1-7/config-repo -spring.cloud.config.server.git.username=username -spring.cloud.config.server.git.password=password +spring.cloud.config.server.git.uri=https://gitee.com/pdb2010/config-server +#spring.cloud.config.server.git.searchPaths=Chapter1-1-7/config-repo +spring.cloud.config.server.git.username=pangdabo2010@hotmail.com +spring.cloud.config.server.git.password=ZXCVbnm.123 #kafka spring.cloud.stream.kafka.binder.zk-nodes=localhost:2181 -spring.cloud.stream.kafka.binder.brokers=localhost:9092 \ No newline at end of file +spring.cloud.stream.kafka.binder.brokers=localhost:9092 + +#spring.cloud.stream.kafka.binder.brokers Kafkaķб localhost +#spring.cloud.stream.kafka.binder.defaultBrokerPort Kafka˵Ĭ϶˿ڣbrokersûö˿ϢʱͻʹĬ϶˿ 9092 +#spring.cloud.stream.kafka.binder.zkNodes KafkaӵZooKeeperڵб localhost +#spring.cloud.stream.kafka.binder.defaultZkPort ZooKeeperڵĬ϶˿ڣzkNodesûö˿ϢʱͻʹĬ϶˿ 2181 \ No newline at end of file