JEECG系统配置文件用法

23 篇文章 0 订阅

JEECG系统配置文件位于:

main/resousres/sysConfig.properties文件

那么在什么地方用到呢:

  • main/java/org.jeecgframework.core.util/jeecgSqlUtil.java

代码:
	private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("sysConfig");

	public static String getMethodSql(String methodUrl) {
		
		//[1].开发模式:dev SQL文件每次都加载
		if(ConstantsDefs.MODE_DEVELOP.equals(bundle.getObject("sqlReadMode"))){
			return getMethodSqlLogicJar(methodUrl);
		}
		//[2].发布模式:pub SQL文件只加载一次
		else if(ConstantsDefs.MODE_PUBLISH.equals(bundle.getObject("sqlReadMode"))){
			Element element = dictCache.get(methodUrl);
			if (element == null) {
				element = new Element(methodUrl, (Serializable) getMethodSqlLogicJar(methodUrl));
				//永久缓存
				dictCache.put(element);
			}
			return element.getValue().toString();
		}
		else{
			return "";
		}
	}

  • main/java/org/jeecgframework/core/util/PropertiesUtil.java
	public static void main(String[] args) {
		PropertiesUtil p = new PropertiesUtil("sysConfig.properties");
		p.writeProperty("namess", "wang");
		org.jeecgframework.core.util.LogUtil.info(p.readProperty("namess"));
	}

  • main/java/org/jeecgframework/core/util/ResourceUtil.java
private static final ResourceBundle bundle = java.util.ResourceBundle.getBundle("sysConfig");

	/**
	 * 获取数据库类型
	 * 
	 * @return
	 * @throws Exception 
	 */
	public static final String getJdbcUrl() {
		return DBTypeUtil.getDBType().toLowerCase();
	}

//    update-begin--Author:zhangguoming  Date:20140226 for:添加验证码
    /**
     * 获取随机码的长度
     *
     * @return 随机码的长度
     */
    public static String getRandCodeLength() {
        return bundle.getString("randCodeLength");
    }



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值