config.xml 配置文件里添加url
http://127.0.0.1:8081
applicationContext.xml 配置文件配置
common公共配置下的systemConfig.java文件
public class SystemConfig {
public static String mainServerUrl =null;
/**点击鼠标右键,source -> Gnerate getters and Setters 选择对应生成get set*/
public static String getMainServerUrl() {
return mainServerUrl;
}
public static void setMainServerUrl(String mainServerUrl) {
SystemConfig.mainServerUrl = mainServerUrl;
}
}
使用
import com.linyun.xgame.common.SystemConfig;
import org.slf4j.Logger;/**log*/
public class MainService implements IMainService {
private Logger logger=LoggerFactory.getLogger(MainService.class);
@Override
public void create(String id) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map params = new HashMap();
params.put("id",id);
logger.info(SystemConfig.Url + "/main/create");
String result = HttpClientUtil.getInstance().postRequest(SystemConfig.Url
+ "/main/create", params);
logger.info(result);
}
}
/**调用mainservice里的create*/
public interface IMainService {
public void create(String id);
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)