From c3d71e8da5e71952679bcb2361371070829d7504 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Tue, 12 Jan 2021 14:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dipperposition/config/PositionConfig.java | 18 ++++++++++++++++++ .../controller/DipperPositionController.java | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/telpo/dipperposition/config/PositionConfig.java b/src/main/java/com/telpo/dipperposition/config/PositionConfig.java index 7e0b866..0826f8d 100644 --- a/src/main/java/com/telpo/dipperposition/config/PositionConfig.java +++ b/src/main/java/com/telpo/dipperposition/config/PositionConfig.java @@ -29,5 +29,23 @@ import java.util.Properties; @Configuration @ConfigurationProperties(prefix = "position") public class PositionConfig { + @Value("${position.hello}") + private String hello; + PositionConfig() + { + } + + private static PositionConfig instance; + public static PositionConfig getInstance(){ + if (instance==null){ + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + instance = new PositionConfig(); + } + return instance; + } } diff --git a/src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java b/src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java index d31777a..619e305 100644 --- a/src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java +++ b/src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java @@ -44,7 +44,7 @@ public class DipperPositionController { // //log.info(positionId + ":" + content.positionId) // Map dataMap = NacosDataParserHandler.getInstance().parseNacosData(content,"yaml"); // return dataMap == null ? "" : (String)dataMap.get(positionId); - return RzlAccount.getInstance().getHello(); + return PositionConfig.getInstance().getHello(); //return "Helle world!"; //ContextLoader.getCurrentWebApplicationContext().toString(); } }