读取xml文件中的配置参数实例
paras.xml文件
SysParam.java类文件
packagecom.wisoft.tysfrz.utils;
/**
*系统配置参数
*
*@authorZHENWENCAN
*@date2017年10月9日下午1:09:48
*/
publicclassSysParam{
//行政区划代码前台显示默认值
privateStringzoneCode;
//二代证读卡器读取照片存储位置
privateStringsfzpicpath;
//保存身份证照片相对路径
privateStringphotoRealPath;
publicStringgetZoneCode(){
returnzoneCode;
}
publicvoidsetZoneCode(StringzoneCode){
this.zoneCode=zoneCode;
}
publicStringgetSfzpicpath(){
returnsfzpicpath;
}
publicvoidsetSfzpicpath(Stringsfzpicpath){
this.sfzpicpath=sfzpicpath;
}
publicStringgetPhotoRealPath(){
returnphotoRealPath;
}
publicvoidsetPhotoRealPath(StringphotoRealPath){
this.photoRealPath=photoRealPath;
}
}
使用
privatestaticApplicationContextcpxac=newClassPathXmlApplicationContext("tysfrz/spring/tysfrz_params.xml");
privatestaticSysParamsysparam=(SysParam)cpxac.getBean("SysParam");
Stringphotorealpath=sysparam.getPhotoRealPath();
需要引用包
importorg.springframework.context.ApplicationContext; importorg.springframework.context.support.ClassPathXmlApplicationContext;
以上这篇读取xml文件中的配置参数实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
热门推荐
10 诗词送行祝福语大全简短
11 新房开工吉日祝福语简短
12 50多岁生日简短祝福语
13 安徽疫情祝福语简短英语
14 农民朋友发财祝福语简短
15 对生活祝福语简短精辟
16 搬家词简短祝福语朋友
17 女神结婚快乐祝福语简短
18 文学短句祝福语大全简短