GSCServicePoolConfig.java
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package cn.com.glsx.stoassistant.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
/**
* GSC 服务池配置
*
* @author system
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "gsc.common")
public class GSCServicePoolConfig {
/**
* GSC 服务池配置
* key: 服务名称(如 gsc-vcp-web-facade)
* value: 服务配置参数
*/
private Map<String, GSCServiceParam> gscPool = new HashMap<>();
/**
* 获取指定服务的配置
*
* @param serviceName 服务名称
* @return 服务配置参数
*/
public GSCServiceParam getServiceParam(String serviceName) {
GSCServiceParam param = gscPool.get(serviceName);
if (param == null) {
throw new IllegalArgumentException("未找到服务配置:" + serviceName);
}
return param;
}
/**
* GSC 服务配置参数
*/
@Data
public static class GSCServiceParam {
/**
* 服务基础URL
*/
private String baseurl;
/**
* 应用ID
*/
private String appId;
/**
* 随机字符串
*/
private String nonce;
/**
* 密钥
*/
private String secret;
}
}