MallDynamicProperty.java
2.24 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.diligrp.cashier.mall.property;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* @author dengwei
* @version 1.0.0
* @ClassName MallDynamicProperty.java
* @Description MallDynamicProperty
*/
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "sign")
public class MallDynamicProperty {
private List<AppSecretDynamicProperty> appSecrets;
public static class AppSecretDynamicProperty {
@Value("${source:1}")
private Integer source;
@Value("${appKey:}")
private String appKey;
@Value("${appSecret:}")
private String appSecret;
@Value("${authUrl:https://hourh5-em-shop.feiniugo.com}")
private String authUrl;
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public String getAppSecret() {
return appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public String getAuthUrl() {
return authUrl;
}
public void setAuthUrl(String authUrl) {
this.authUrl = authUrl;
}
}
public List<AppSecretDynamicProperty> getAppSecrets() {
return appSecrets;
}
public void setAppSecrets(List<AppSecretDynamicProperty> appSecrets) {
this.appSecrets = appSecrets;
}
/**
* getBySource
*
*/
public AppSecretDynamicProperty getBySource(Integer source) {
return Optional.ofNullable(appSecrets)
.orElse(Collections.emptyList())
.stream()
.filter(item -> item.getSource().equals(source))
.findFirst()
.orElse(null);
}
}