标签:service over coop rac res instance turn ltm tst
Demo出处:
1. package com.fpx.pcs.prealert.process.xml.service.impl;
public class CainiaoPushMessageServiceImpl implements ICainiaoPushMessageService {
@Resource
private CommonImpl commonImpl;
@Override
public ResultMessage execute(String xml, String msg_type, String packageCarrierType, String countryCode) {
CaiNiaoCallBackConfig config=commonImpl.getConfig("CaiNiaoCallBackConfig",CaiNiaoCallBackConfig.class);
}
2.---CaiNiaoCallBackConfig 类---------------------
@data
public class CaiNiaoCallBackConfig implements Serializable{
private static final long serialVersionUID=1L;
private String CONSO3PLcooperationCode;
private String CONSO3PLencryprDigest;
private String CONSO3PLreturnUrl;
}
3.getConfig 写法
public <T> T getConfig(String configName,Class<T> targetClass){
List<SysParameterPO> configs=getListByName(configName);
if(CollectionUtils.isEmpty(configs)){
return null;
}
T t=null;
try{
t=targetClass.newInstance();
for(SysParameterPO config :configs){
try{
Method method=t.getClass().getMethod("set"+config.getCode(),String.class);
if(method !=null){
method.invoke(t,config.getvalue());
}
catch(Exception e)
}
catch(Exception e)
{
}
}
}
catch(InstantiationException | illegeAccessException e){
e.printStatckTrace();
}
catch(SecurityException e)
{
e.printStackTrace();
}
}
标签:service over coop rac res instance turn ltm tst
原文地址:https://www.cnblogs.com/chengjun/p/9283639.html