diff --git a/config-server/src/main/resources/application.yml b/config-server/src/main/resources/application.yml index 9e34d24..7905d49 100644 --- a/config-server/src/main/resources/application.yml +++ b/config-server/src/main/resources/application.yml @@ -7,7 +7,7 @@ spring: config: server: git: - uri: xxxxx + uri: http://47.121.181.112:3000/wonder/spring-cloud-config search-paths: config-files eureka: diff --git a/pom.xml b/pom.xml index 30f52f7..769ea9d 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ eureka-server config-server + service-producer diff --git a/service-producer/pom.xml b/service-producer/pom.xml new file mode 100644 index 0000000..4ede68f --- /dev/null +++ b/service-producer/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + cn.hezhaohui + spring-cloud-template + 1.0-SNAPSHOT + + + service-producer + + + 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 + + + + \ No newline at end of file diff --git a/service-producer/src/main/java/cn/hezhaohui/serviceproducer/ServiceProducerApplication.java b/service-producer/src/main/java/cn/hezhaohui/serviceproducer/ServiceProducerApplication.java new file mode 100644 index 0000000..1825219 --- /dev/null +++ b/service-producer/src/main/java/cn/hezhaohui/serviceproducer/ServiceProducerApplication.java @@ -0,0 +1,12 @@ +package cn.hezhaohui.serviceproducer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication + +public class ServiceProducerApplication { + public static void main(String[] args) { + SpringApplication.run(ServiceProducerApplication.class, args); + } +} diff --git a/service-producer/src/main/java/cn/hezhaohui/serviceproducer/controller/HealthController.java b/service-producer/src/main/java/cn/hezhaohui/serviceproducer/controller/HealthController.java new file mode 100644 index 0000000..e98ce7b --- /dev/null +++ b/service-producer/src/main/java/cn/hezhaohui/serviceproducer/controller/HealthController.java @@ -0,0 +1,19 @@ +package cn.hezhaohui.serviceproducer.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-producer/src/main/resources/bootstrap.yml b/service-producer/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..e23cfc0 --- /dev/null +++ b/service-producer/src/main/resources/bootstrap.yml @@ -0,0 +1,11 @@ +spring: + application: + name: service-producer + cloud: + config: + uri: http://localhost:8888 + fail-fast: true +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka \ No newline at end of file