From 1647838182eef79784c35dbdd86c822a8d3f850c Mon Sep 17 00:00:00 2001 From: "woozu.shin" Date: Mon, 18 Oct 2021 15:37:27 +0900 Subject: [PATCH] Add common property --- .../client1/controller/PropertyAPIController.java | 13 +++++++++++++ src/main/resources/application.yml | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/kakaoent/cpdd/config/client1/controller/PropertyAPIController.java b/src/main/java/com/kakaoent/cpdd/config/client1/controller/PropertyAPIController.java index 8bc4423..6e3bec0 100644 --- a/src/main/java/com/kakaoent/cpdd/config/client1/controller/PropertyAPIController.java +++ b/src/main/java/com/kakaoent/cpdd/config/client1/controller/PropertyAPIController.java @@ -1,9 +1,11 @@ package com.kakaoent.cpdd.config.client1.controller; import com.kakaoent.cpdd.config.client1.configuration.properties.ApiProperties; +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; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @RequestMapping("/api/v1") @@ -12,6 +14,12 @@ public class PropertyAPIController { private final ApiProperties apiProperties; + @Value("${app1-common-property}") + private String app1CommonProperty; + + @Value("${application-common-property}") + private String applicationCommonProperty; + public PropertyAPIController(ApiProperties apiProperties) { this.apiProperties = apiProperties; } @@ -26,4 +34,9 @@ public class PropertyAPIController { return Mono.just(apiProperties.find("point").getUrl()); } + @GetMapping("/commonProperty") + public Flux getCommonProperty() { + return Flux.just(app1CommonProperty, applicationCommonProperty); + } + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index be05015..457d884 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,8 @@ spring: prod: prod,datasource-prod,redis-prod config: - import: "optional:configserver:http://localhost:11080" + import: "configserver:http://localhost:11080" + # import: optional:configserver:http://localhost:11080 # can be start up even config server was not found. logging.level: org: TRACE