浏览代码

增加OkHttp配置文件读取

tags/v1.0.0^2
林万龙 3 年前
父节点
当前提交
b26b4a11e8
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. +8
    -2
      src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java

+ 8
- 2
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);



正在加载...
取消
保存