فهرست منبع

修改es读取host port

15810770710@163.com 3 سال پیش
والد
کامیت
c602dfa13f
2فایلهای تغییر یافته به همراه2 افزوده شده و 6 حذف شده
  1. 2 4
      src/main/java/com/jkcredit/record/storage/config/EsConfig.java
  2. 0 2
      src/main/resources/application-prod.yml

+ 2 - 4
src/main/java/com/jkcredit/record/storage/config/EsConfig.java

@@ -27,10 +27,6 @@ import java.util.Properties;
 @Slf4j
 @Configuration
 public class EsConfig {
-    @Value("${ElasticSearch.host}")
-    private String host;
-    @Value("${ElasticSearch.port}")
-    private Integer port;
     @Value("${ElasticSearch.userFilePath}")
     private String userFilePath;
 
@@ -46,6 +42,8 @@ public class EsConfig {
         }
         String username = properties.getProperty("username");
         String password = properties.getProperty("password");
+        String host = properties.getProperty("host");
+        int port = Integer.parseInt(properties.getProperty("port"));
 
         RestClientBuilder builder = null;
         // 可以指定多个es

+ 0 - 2
src/main/resources/application-prod.yml

@@ -1,4 +1,2 @@
 ElasticSearch:
-  host: es-cn-2r427cps10022b0yt.elasticsearch.aliyuncs.com
-  port: 9200
   userFilePath: /home/jkxy-01/key.properties