luobang 1 year ago
parent
commit
2510ff0be2

+ 6 - 2
src/main/java/com/steerinfo/dil/util/HTTPRequestUtils.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.util;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.http.HttpEntity;
 import org.apache.http.ParseException;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
@@ -33,9 +34,13 @@ public class HTTPRequestUtils {
 
         //创建httpclient对象
         CloseableHttpClient client = HttpClients.createDefault();
+
         //创建post方式请求对象
         HttpPost httpPost = new HttpPost(url);
-
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout(5000).setConnectionRequestTimeout(1000)
+                .setSocketTimeout(5000).build();
+        httpPost.setConfig(requestConfig);
         //装填参数
         StringEntity s = new StringEntity(json.toString(), "utf-8");
         s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json"));
@@ -44,7 +49,6 @@ public class HTTPRequestUtils {
         System.out.println("请求地址:" + url);
         System.out.println(json);
 //        System.out.println("请求参数:"+nvps.toString());
-
         //设置header信息
         //指定报文头【Content-type】、【User-Agent】
 //        httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");

+ 6 - 1
src/main/resources/application-prod.yml

@@ -1,10 +1,15 @@
 #正式环境
 spring:
   datasource:
-    jdbc.url: jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri
+    url: jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri
     password: Dil123789
     username: dil
     driver-class-name: oracle.jdbc.OracleDriver
+    druid:
+      max-active: 50
+      initial-size: 5
+      min-idle: 3
+      max-wait: 1800000
 
   application:
     name: DAL-OMS-API-PROD