diff --git a/pom.xml b/pom.xml
index a5c2f5e33f6375b8cc5832f459145c78f79effcd..a49f52ae5230c31d27295ec49f34b3b89503b51e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,7 @@
springcloud-service-config
springcloud-service-config-client
springcloud-service-feign
+ springcloud-service-zuul
springcloud-service-eureka
diff --git a/springcloud-service-common/pom.xml b/springcloud-service-common/pom.xml
index c83ec3a9a30ac0da7c0598cda79feece17b550c4..ada696a01cbba42ade1f941f3e9bee2b9735d46d 100644
--- a/springcloud-service-common/pom.xml
+++ b/springcloud-service-common/pom.xml
@@ -45,6 +45,10 @@
org.springframework.cloud
spring-cloud-commons
+
+ com.netflix.ribbon
+ ribbon-loadbalancer
+
diff --git a/springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java b/springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
index 9a360b0095630b3b4daf46391f7bf7b2152b7950..9734a9b184ae95e396d71b47147039d49b014948 100644
--- a/springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
+++ b/springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
@@ -1,5 +1,7 @@
package com.kwan.springcloud.config;
+import com.netflix.loadbalancer.IRule;
+import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,4 +15,12 @@ public class RestConfig {
public RestTemplate restTemplate() {
return new RestTemplate();
}
-}
+
+ /**
+ * 自定义负载均衡
+ */
+ @Bean
+ public IRule microIrule() {
+ return new RandomRule();
+ }
+}
\ No newline at end of file
diff --git a/springcloud-service-portal/pom.xml b/springcloud-service-portal/pom.xml
index 516cea08292c37068cc766901c84eb374cb05a75..9fb6d1186e993051f291d083c6d5ced33f0aaf25 100644
--- a/springcloud-service-portal/pom.xml
+++ b/springcloud-service-portal/pom.xml
@@ -27,7 +27,7 @@
org.springframework.cloud
- spring-cloud-starter-netflix-eureka-server
+ spring-cloud-starter-netflix-eureka-client
diff --git a/springcloud-service-zuul/pom.xml b/springcloud-service-zuul/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4549c54bfc872e72096d5947647366b9e7b8762a
--- /dev/null
+++ b/springcloud-service-zuul/pom.xml
@@ -0,0 +1,45 @@
+
+
+ 4.0.0
+
+ com.kwan.springcloud
+ springcloud-service-parent
+ 1.0.0
+
+ springcloud-service-zuul
+ 0.0.1-SNAPSHOT
+ springcloud-service-zuul
+
+ 1.8
+
+
+
+
+ com.kwan.springcloud
+ springcloud-service-common
+ 1.0.0
+ compile
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-netflix-zuul
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
\ No newline at end of file
diff --git a/springcloud-service-zuul/src/main/java/com/kwan/springcloud/ZuulApplication.java b/springcloud-service-zuul/src/main/java/com/kwan/springcloud/ZuulApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..72c97a29addfbb7ef5060b3030b25d20d8e1c294
--- /dev/null
+++ b/springcloud-service-zuul/src/main/java/com/kwan/springcloud/ZuulApplication.java
@@ -0,0 +1,13 @@
+package com.kwan.springcloud;
+
+
+@EnableZuulProxy
+@SpringBootApplication
+public class ZuulApplication {
+
+ public static void main(String[] args) {
+
+ SpringApplication.run(ZuulApplication.class, args);
+ }
+
+}
diff --git a/springcloud-service-zuul/src/main/resources/application.yaml b/springcloud-service-zuul/src/main/resources/application.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..665aa0fda042f988c15ecf9573c9f51f97d3019b
--- /dev/null
+++ b/springcloud-service-zuul/src/main/resources/application.yaml
@@ -0,0 +1,13 @@
+#端口号
+server:
+ port: 8888
+
+spring:
+ application:
+ name: zuul-service #服务名称
+
+#服务提供者
+eureka:
+ client:
+ service-url:
+ defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
diff --git a/springcloud-service-zuul/src/test/java/com/kwan/springcloud/PortalApplicationTests.java b/springcloud-service-zuul/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a8e650e3ec9e02f15e843b39496d32bf600724b
--- /dev/null
+++ b/springcloud-service-zuul/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
@@ -0,0 +1,13 @@
+package com.kwan.springcloud;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class PortalApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}