diff --git a/pom.xml b/pom.xml
index 769ea9d..986fcc4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,7 @@
eureka-server
config-server
service-producer
+ service-consumer
diff --git a/service-consumer/pom.xml b/service-consumer/pom.xml
new file mode 100644
index 0000000..e9d32a9
--- /dev/null
+++ b/service-consumer/pom.xml
@@ -0,0 +1,50 @@
+
+
+ 4.0.0
+
+ cn.hezhaohui
+ spring-cloud-template
+ 1.0-SNAPSHOT
+
+
+ service-consumer
+
+
+ 21
+ 21
+ UTF-8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.cloud
+ spring-cloud-netflix-eureka-client
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-config
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-loadbalancer
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/ServiceConsumerApplication.java b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/ServiceConsumerApplication.java
new file mode 100644
index 0000000..de7ff87
--- /dev/null
+++ b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/ServiceConsumerApplication.java
@@ -0,0 +1,11 @@
+package cn.hezhaohui.serviceconsumer;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ServiceConsumerApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(ServiceConsumerApplication.class, args);
+ }
+}
diff --git a/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/config/RestTemplateConfig.java b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/config/RestTemplateConfig.java
new file mode 100644
index 0000000..f1fec28
--- /dev/null
+++ b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/config/RestTemplateConfig.java
@@ -0,0 +1,16 @@
+package cn.hezhaohui.serviceconsumer.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;
+
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ @LoadBalanced
+ public RestTemplate restTemplate () {
+ return new RestTemplate();
+ }
+}
diff --git a/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/ConsumeController.java b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/ConsumeController.java
new file mode 100644
index 0000000..2fac9f5
--- /dev/null
+++ b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/ConsumeController.java
@@ -0,0 +1,22 @@
+package cn.hezhaohui.serviceconsumer.controller;
+
+import jakarta.annotation.Resource;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+@RestController
+@RequestMapping("/api")
+public class ConsumeController {
+
+ @Resource
+ private RestTemplate restTemplate;
+
+ @GetMapping("/print")
+ public String print() {
+ String number = restTemplate.getForObject("http://service-producer/api/number", String.class);
+ return "[Generate]: " + number;
+ }
+
+}
diff --git a/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/HealthController.java b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/HealthController.java
new file mode 100644
index 0000000..80fd405
--- /dev/null
+++ b/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/HealthController.java
@@ -0,0 +1,19 @@
+package cn.hezhaohui.serviceconsumer.controller;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api")
+public class HealthController {
+
+ @Value("${test.message}")
+ private String testMessage;
+
+ @GetMapping("/health")
+ public String health() {
+ return "Wow, nice to meet you!" + "\n" + testMessage;
+ }
+}
diff --git a/service-consumer/src/main/resources/bootstrap.yml b/service-consumer/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..2a607aa
--- /dev/null
+++ b/service-consumer/src/main/resources/bootstrap.yml
@@ -0,0 +1,11 @@
+spring:
+ application:
+ name: service-consumer
+ cloud:
+ config:
+ uri: http://localhost:8888
+ fail-fast: true
+eureka:
+ client:
+ service-url:
+ defaultZone: http://localhost:8761/eureka
\ No newline at end of file