Flask接口签名sign原理与实例代码浅析
251
2023-03-27
读取xml文件中的配置参数实例
paras.xml文件
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:aop="http://springframework.org/schema/aop" xmlns:tx="http://springframework.org/schema/tx" xmlns:context="http://springframework.org/schema/context" xsi:schemaLocation=" http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-2.5.xsd http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-2.5.xsd http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-2.5.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-2.5.xsd">
xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
xmlns:aop="http://springframework.org/schema/aop"
xmlns:tx="http://springframework.org/schema/tx"
xmlns:context="http://springframework.org/schema/context"
xsi:schemaLocation="
http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-2.5.xsd
http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-2.5.xsd
http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-2.5.xsd
http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-2.5.xsd">
SysParam.java类文件
package com.wisoft.tysfrz.utils;
/**
* 系统配置参数
*
* @author ZHENWENCAN
* @date 2017年10月9日 下午1:09:48
*/
public class SysParam {
//行政区划代码前台显示默认值
private String zoneCode;
//二代证读卡器读取照片存储位置
private String sfzpicpath;
//保存身份证照片相对路径
private String photoRealPath;
public String getZoneCode() {
return zoneCode;
}
public void setZoneCode(String zoneCode) {
this.zoneCode = zoneCode;
}
public String getSfzpicpath() {
return sfzpicpath;
}
public void setSfzpicpath(String sfzpicpath) {
this.sfzpicpath = sfzpicpath;
}
public String getPhotoRealPath() {
return photoRealPath;
}
public void setPhotoRealPath(String photoRealPath) {
this.photoRealPath = photoRealPath;
}
}
使用
private static ApplicationChttp://ontext cpxac = new ClassPathXmlApplicationContext("tysfrz/spring/tysfrz_params.xml");
private static SysParam sysparam = (SysParam) cpxac.getBean("SysParam");
String photorealpath = sysparam.getPhotoRealPath();
需要引用包
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~