From b26b4a11e8f7c34654d8d1cec15cede552cbc888 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Fri, 15 Jan 2021 18:35:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0OkHttp=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=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/server/DipperPositionServer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java index 157aea2..bbe51d2 100644 --- a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java +++ b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java @@ -40,11 +40,17 @@ public class DipperPositionServer { public DipperPositionServer() throws NacosException { //String serverAddr = positionConfigInfo.getServerAddr(); try { - InetAddress ip4 = Inet4Address.getLocalHost(); + try { + InetAddress ip4 = Inet4Address.getLocalHost(); + serverAddr = ip4.getHostAddress(); + } catch (Exception ex) { + serverAddr = "172.16.192.26"; + ex.printStackTrace(); + } String dataId = "dipperposition-service"; String group = "DEFAULT_GROUP"; Properties properties = new Properties(); - properties.put(PropertyKeyConst.SERVER_ADDR, ip4.getHostAddress()); + properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr); ConfigService configService = NacosFactory.createConfigService(properties); String content = configService.getConfig(dataId, group, 5000);