diff --git a/parent/.gitignore b/config-client/.gitignore
similarity index 100%
rename from parent/.gitignore
rename to config-client/.gitignore
diff --git a/config-client/pom.xml b/config-client/pom.xml
new file mode 100644
index 0000000..9d6bd27
--- /dev/null
+++ b/config-client/pom.xml
@@ -0,0 +1,81 @@
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.0.3.RELEASE
+
+ config-client
+ 1.0.0
+ config-client
+ jar
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Finchley.RELEASE
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.cloud
+ spring-cloud-starter-config
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-eureka-client
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bus-amqp
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+ configClient
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config-client/src/main/java/vip/xumy/learn/config/client/ConfigClientApplication.java b/config-client/src/main/java/vip/xumy/learn/config/client/ConfigClientApplication.java
new file mode 100644
index 0000000..9bf2660
--- /dev/null
+++ b/config-client/src/main/java/vip/xumy/learn/config/client/ConfigClientApplication.java
@@ -0,0 +1,31 @@
+package vip.xumy.learn.config.client;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@SpringBootApplication
+@EnableEurekaClient
+@EnableDiscoveryClient
+@RestController
+@RefreshScope
+public class ConfigClientApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConfigClientApplication.class, args);
+ }
+
+ @Value("${foo}")
+ String foo;
+ @RequestMapping(value = "/hi")
+ public String hi(){
+ return foo;
+ }
+}
+
+
diff --git a/config-client/src/main/resources/application.properties b/config-client/src/main/resources/application.properties
new file mode 100644
index 0000000..b3552b4
--- /dev/null
+++ b/config-client/src/main/resources/application.properties
@@ -0,0 +1,20 @@
+spring.application.name=config-client
+spring.cloud.config.label=master
+spring.cloud.config.profile=dev
+spring.cloud.config.uri= http://localhost:8888/
+server.port=8881
+
+eureka.client.serviceUrl.defaultZone=http://cloud.xumy.vip/eureka/
+spring.cloud.config.discovery.enabled=true
+spring.cloud.config.discovery.serviceId=config-server
+
+
+spring.rabbitmq.host=mq.xumy.vip
+spring.rabbitmq.port=5672
+spring.rabbitmq.username=admin
+spring.rabbitmq.password=123456
+
+spring.cloud.bus.enabled=true
+spring.cloud.bus.trace.enabled=true
+management.endpoints.web.exposure.include=bus-refresh
+
diff --git a/config-server/.gitignore b/config-server/.gitignore
new file mode 100644
index 0000000..338ed4c
--- /dev/null
+++ b/config-server/.gitignore
@@ -0,0 +1,8 @@
+/.classpath
+/.project
+/.settings
+/bin/
+/logs
+/target
+*.log
+/src/main/resources/static
\ No newline at end of file
diff --git a/config-server/pom.xml b/config-server/pom.xml
new file mode 100644
index 0000000..f5c0d88
--- /dev/null
+++ b/config-server/pom.xml
@@ -0,0 +1,72 @@
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.0.3.RELEASE
+
+ config-server
+ 1.0.0
+ config-server
+ jar
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Finchley.RELEASE
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-eureka-client
+
+
+ org.springframework.cloud
+ spring-cloud-config-server
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+ configServer
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config-server/src/main/java/vip/xumy/learn/config/server/ConfigServerApplication.java b/config-server/src/main/java/vip/xumy/learn/config/server/ConfigServerApplication.java
new file mode 100644
index 0000000..f825b69
--- /dev/null
+++ b/config-server/src/main/java/vip/xumy/learn/config/server/ConfigServerApplication.java
@@ -0,0 +1,16 @@
+package vip.xumy.learn.config.server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.config.server.EnableConfigServer;
+
+@SpringBootApplication
+@EnableConfigServer
+public class ConfigServerApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConfigServerApplication.class, args);
+ }
+}
+
+
diff --git a/config-server/src/main/resources/application.properties b/config-server/src/main/resources/application.properties
new file mode 100644
index 0000000..1ac6933
--- /dev/null
+++ b/config-server/src/main/resources/application.properties
@@ -0,0 +1,11 @@
+spring.application.name=config-server
+server.port=8888
+
+spring.cloud.config.server.git.uri=https://www.xumy.vip/mengyxu/cloudConfig
+spring.cloud.config.server.git.searchPaths=respo
+spring.cloud.config.label=master
+spring.cloud.config.server.git.username=
+spring.cloud.config.server.git.password=
+
+eureka.client.serviceUrl.defaultZone=http://eureka1.xumy.vip/eureka/
+
diff --git a/eureka-gateway/.gitignore b/eureka-gateway/.gitignore
new file mode 100644
index 0000000..338ed4c
--- /dev/null
+++ b/eureka-gateway/.gitignore
@@ -0,0 +1,8 @@
+/.classpath
+/.project
+/.settings
+/bin/
+/logs
+/target
+*.log
+/src/main/resources/static
\ No newline at end of file
diff --git a/eureka-gateway/pom.xml b/eureka-gateway/pom.xml
new file mode 100644
index 0000000..3b50128
--- /dev/null
+++ b/eureka-gateway/pom.xml
@@ -0,0 +1,72 @@
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.0.3.RELEASE
+
+ eureka-client-zuul
+ 1.0.0
+ eureka-client-zuul
+ jar
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Finchley.RELEASE
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-eureka-client
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-zuul
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+ zuul
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/MyFilter.java b/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/MyFilter.java
new file mode 100644
index 0000000..a4039b8
--- /dev/null
+++ b/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/MyFilter.java
@@ -0,0 +1,65 @@
+package vip.xumy.learn.eureka.client;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import com.netflix.zuul.ZuulFilter;
+import com.netflix.zuul.context.RequestContext;
+
+@Component
+public class MyFilter extends ZuulFilter {
+
+ private static Logger log = LoggerFactory.getLogger(MyFilter.class);
+
+ /**
+ * filterType:返回一个字符串代表过滤器的类型,在zuul中定义了四种不同生命周期的过滤器类型,具体如下: pre:路由之前
+ * routing:路由之时 post: 路由之后 error:发送错误调用
+ */
+ @Override
+ public String filterType() {
+ return "pre";
+ }
+
+ /**
+ * filterOrder:过滤的顺序
+ */
+ @Override
+ public int filterOrder() {
+ return 0;
+ }
+
+ /**
+ * shouldFilter:这里可以写逻辑判断,是否要过滤,true,永远过滤。
+ */
+ @Override
+ public boolean shouldFilter() {
+ return true;
+ }
+
+ /**
+ * run:过滤器的具体逻辑。可用很复杂,包括查sql,nosql去判断该请求到底有没有权限访问。
+ */
+ @Override
+ public Object run() {
+ RequestContext ctx = RequestContext.getCurrentContext();
+ HttpServletRequest request = ctx.getRequest();
+ log.info(String.format("%s >>> %s", request.getMethod(), request.getRequestURL().toString()));
+ Object accessToken = request.getParameter("token");
+ if (accessToken == null) {
+ log.warn("token is empty");
+ ctx.setSendZuulResponse(false);
+ ctx.setResponseStatusCode(401);
+ try {
+ ctx.getResponse().getWriter().write("token is empty");
+ } catch (Exception e) {
+ }
+
+ return null;
+ }
+ log.info("ok");
+ return null;
+ }
+}
diff --git a/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/ServiceZuulApplication.java b/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/ServiceZuulApplication.java
new file mode 100644
index 0000000..55e43cb
--- /dev/null
+++ b/eureka-gateway/src/main/java/vip/xumy/learn/eureka/client/ServiceZuulApplication.java
@@ -0,0 +1,25 @@
+package vip.xumy.learn.eureka.client;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
+
+@SpringBootApplication
+@EnableEurekaClient
+@EnableDiscoveryClient
+@EnableZuulProxy
+public class ServiceZuulApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run( ServiceZuulApplication.class, args );
+ }
+
+}
+
+
+
+
+
+
diff --git a/eureka-gateway/src/main/resources/application.properties b/eureka-gateway/src/main/resources/application.properties
new file mode 100644
index 0000000..e71ba81
--- /dev/null
+++ b/eureka-gateway/src/main/resources/application.properties
@@ -0,0 +1,10 @@
+server.port=8080
+
+eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
+
+spring.application.name=eureka-zuul
+
+zuul.routes.ribbon.path=/ribbon/**
+zuul.routes.ribbon.serviceId=eureka-ribbon
+zuul.routes.feign.path=/feign/**
+zuul.routes.feign.serviceId=eureka-feign
diff --git a/eureka-hi/pom.xml b/eureka-hi/pom.xml
index e818c71..8483ffd 100644
--- a/eureka-hi/pom.xml
+++ b/eureka-hi/pom.xml
@@ -11,7 +11,7 @@
1.0.0
eureka-client-hi
jar
-
+
UTF-8
UTF-8
@@ -19,20 +19,21 @@
Finchley.RELEASE
+
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-eureka-client
-
-
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-eureka-client
+
+
org.springframework.boot
spring-boot-starter-web
-
+
@@ -44,18 +45,19 @@
-
+
hi
org.springframework.boot
spring-boot-maven-plugin
-
-
+
true
+
-
+
+
\ No newline at end of file
diff --git a/eureka-hi/src/main/resources/application.properties b/eureka-hi/src/main/resources/application.properties
index ddca29e..cc77b44 100644
--- a/eureka-hi/src/main/resources/application.properties
+++ b/eureka-hi/src/main/resources/application.properties
@@ -1,6 +1,6 @@
-server.port=8762
+server.port=8763
-eureka.client.serviceUrl.defaultZone=http://eureka.xumy.vip/eureka/
+eureka.client.serviceUrl.defaultZone=http://eureka1.xumy.vip/eureka/
spring.application.name=eureka-hi
diff --git a/parent/pom.xml b/parent/pom.xml
deleted file mode 100644
index a902a94..0000000
--- a/parent/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.3.RELEASE
-
- vip.xumy.learn
- spring-cloud-demo
- 1.0.0.RELEASE
- spring-cloud-demo
- pom
-
-
- UTF-8
- UTF-8
- 1.8
- Finchley.RELEASE
-
-
-
- ../eureka-server
- ../service-hi
- ../service-ribbon
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- true
-
-
-
-
-
-
\ No newline at end of file