|
@@ -6,6 +6,7 @@ import okhttp3.*;
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
@@ -194,5 +195,30 @@ public class BeisenTokenManager {
|
|
|
public static String APP_KEY = "6200E9EEE80C440B8342B1F8E8F0DFFE";
|
|
|
public static String APP_SECRET = "BCDF24366FBA4851AEAE2638085548B1D780130E808842049FA7FDDD6D63B18D";
|
|
|
public static String TOKEN_URL = "https://openapi.italent.cn/token";
|
|
|
+
|
|
|
+ static {
|
|
|
+ //从配置文件中读取配置
|
|
|
+ try {
|
|
|
+ BeisenParamByProperties beisenParamByProperties = new BeisenParamByProperties();
|
|
|
+ Map<String, String> config = beisenParamByProperties.getConfig();
|
|
|
+ //如果配置文件中存在配置,则覆盖默认配置
|
|
|
+ if (config != null) {
|
|
|
+ //如果配置文件中存在appKey,则覆盖默认appKey
|
|
|
+ if (config.containsKey("appKey")) {
|
|
|
+ APP_KEY = config.get("appKey");
|
|
|
+ }
|
|
|
+ //如果配置文件中存在appSecret,则覆盖默认appSecret
|
|
|
+ if (config.containsKey("appSecret")) {
|
|
|
+ APP_SECRET = config.get("appSecret");
|
|
|
+ }
|
|
|
+ //如果配置文件中存在tokenUrl,则覆盖默认tokenUrl
|
|
|
+ if (config.containsKey("tokenUrl")) {
|
|
|
+ TOKEN_URL = config.get("tokenUrl");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|