diff --git a/springcloud-service-common/pom.xml b/springcloud-service-common/pom.xml
index 49f398a53f41c2ca260c1da60440cfc86f0d05a6..c83ec3a9a30ac0da7c0598cda79feece17b550c4 100644
--- a/springcloud-service-common/pom.xml
+++ b/springcloud-service-common/pom.xml
@@ -41,6 +41,10 @@
fastjson
1.2.83
+
+ org.springframework.cloud
+ spring-cloud-commons
+
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 1901a31cb7cd6e6addc1bc8984e498df38175230..9a360b0095630b3b4daf46391f7bf7b2152b7950 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,6 @@
package com.kwan.springcloud.config;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@@ -7,6 +8,7 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class RestConfig {
+ @LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
diff --git a/springcloud-service-eureka/src/main/resources/application-eureka8767.yaml b/springcloud-service-eureka/src/main/resources/application-eureka8767.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..cfc750333cad3245dba1202673c36e7939f1f8ab
--- /dev/null
+++ b/springcloud-service-eureka/src/main/resources/application-eureka8767.yaml
@@ -0,0 +1,16 @@
+#端口号
+server:
+ port: 8767
+
+spring:
+ application:
+ name: eurka-server
+
+eureka:
+ instance:
+ hostname: localhost
+ client:
+ register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
+ fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
+ serviceUrl:
+ defaultZone: http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
diff --git a/springcloud-service-eureka/src/main/resources/application-eureka8768.yaml b/springcloud-service-eureka/src/main/resources/application-eureka8768.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..b588e100707347af4d8cdeeda2a731b8c8076354
--- /dev/null
+++ b/springcloud-service-eureka/src/main/resources/application-eureka8768.yaml
@@ -0,0 +1,16 @@
+#端口号
+server:
+ port: 8768
+
+spring:
+ application:
+ name: eurka-server
+
+eureka:
+ instance:
+ hostname: localhost
+ client:
+ register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
+ fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
+ serviceUrl:
+ defaultZone: http://eureka8767:8767/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
diff --git a/springcloud-service-eureka/src/main/resources/application-eureka8769.yaml b/springcloud-service-eureka/src/main/resources/application-eureka8769.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..a5fa0561434911af20fdbb5a137514e5bd631e6c
--- /dev/null
+++ b/springcloud-service-eureka/src/main/resources/application-eureka8769.yaml
@@ -0,0 +1,16 @@
+#端口号
+server:
+ port: 8769
+
+spring:
+ application:
+ name: eurka-server
+
+eureka:
+ instance:
+ hostname: localhost
+ client:
+ register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
+ fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
+ serviceUrl:
+ defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/
\ No newline at end of file
diff --git a/springcloud-service-goods/src/main/resources/application.yaml b/springcloud-service-goods/src/main/resources/application.yaml
index d6347c833cd20e8af785d9e66079fc02d2d21ffd..0fe0e388b2ea8de5be3642f14bc01e795d8bed53 100644
--- a/springcloud-service-goods/src/main/resources/application.yaml
+++ b/springcloud-service-goods/src/main/resources/application.yaml
@@ -17,7 +17,7 @@ spring:
eureka:
client:
service-url:
- defaultZone: http://localhost:8766/eureka
+ defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
management:
endpoints:
diff --git a/springcloud-service-portal/src/main/resources/application.yaml b/springcloud-service-portal/src/main/resources/application.yaml
index 9efa2199c7dfe0d8fe4d081e0028b4e86e6e1cc0..bde245ad34d9cd4834f58ed50dddfb27a1b877ca 100644
--- a/springcloud-service-portal/src/main/resources/application.yaml
+++ b/springcloud-service-portal/src/main/resources/application.yaml
@@ -10,4 +10,4 @@ spring:
eureka:
client:
service-url:
- defaultZone: http://localhost:8766/eureka
\ No newline at end of file
+ defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file