apollo常見資料格式的使用
apollo 相關配置引數
1、string型別
@Value("${a.q}")
private String aQ;
相當於字串,直接使用
2.list 型別,用逗號分割
@Value("#{'${account.pidAndName}'.split(',')}")
private List<String> pidAndName;
for (String str : pidAndName) {
String[] arrary = str.split(":");
............
int i = userId.indexOf(a);
mail = baseMail.get(i);
}
3.map型別
@Value("#{${privateKey}}")
private Map<String,String> privateKey;
String sign = MagCore.buildRequestByRSA(send, privateKey.get(accountNo));
4.格式處理
DateFormat format = null;
if(result.getTradeTime().indexOf("-") != -1) {
format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}else if(result.getTradeTime().indexOf("/") != -1) {
format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
}else {
format = new SimpleDateFormat("yyyyMMddHHmmss");
}
try {
dto.setTrandeTime(format.parse(result.getTradeTime().toString()));
}catch (Exception e) {
e.printStackTrace();
}