package com.thinkgem.jeesite.common.config;

import java.util.Map;

import org.springframework.util.Assert;

import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.utils.PropertiesLoader;

/**
 * 全局配置类
 * @author Thinkgem
 *
 */
public class Global {
	/**
	 * 保存全局属性的值
	 */
	private static Map<String,String> map = Maps.newHashMap();
	/**
	 * 属性文件加载对象
	 */
	private static PropertiesLoader propertiesLoader = new PropertiesLoader("jeesite.properties");
	/**
	 * 获取配置
	 */
	public static String getConfig(String key){
		String value = map.get(key);
		if(value ==  null){
			value = propertiesLoader.getProperty(key);
			map.put(key, value);
		}
		return value;
	}

	/**
	 * 获取管理端根路径
	 */
	public static String getAdminPath(){
		return getConfig("adminPath");
	}
	/**
	 * 获取前端根路径
	 */
	public static String getFrontPath(){
		return getConfig("frontPath");
	}
	/**
	 * 获取URL后缀
	 */
	public static String getUrlSuffix(){
		return getConfig("urlSuffix");
	}
	/**
	 * 判断是否是演示模式,演示模式下不能修改用户、角色、密码、菜单、授权
	 */
	public static Boolean isDemoMode(){
		String dm = getConfig("demoMode");;
		return "true".endsWith(dm) || "1".equals(dm);
	}
	/**
	 * 获取CKFinder上传文件的根目录
	 */
	
	public static String getCkBaseDir(){
		String dir = getConfig("userfiles.basedir");
		Assert.hasText(dir,"配置文件里没有配置userfiles.basedir属性");
		if(!dir.endsWith("/")){
			dir += "/";
		}
		return dir;
	}

}
最近下载更多
managment  LV3 4月17日
vluobo  LV1 3月19日
formatself1  LV2 1月28日
Gin19960217  LV4 1月11日
15210869511  LV1 1月8日
WBelong  LV7 2023年12月28日
颜伟峰  LV1 2023年12月20日
小芳同学  LV1 2023年12月7日
1waxzsq212345  LV2 2023年11月22日
pray654  LV2 2023年11月14日
最近浏览更多
managment  LV3 4月17日
CrystalQ  LV8 4月13日
lo8lukoukoum  LV4 4月10日
ljmadness 4月9日
暂无贡献等级
邓艺妮 4月3日
暂无贡献等级
Chuhhx 4月2日
暂无贡献等级
3334004690  LV3 3月28日
vluobo  LV1 3月19日
暂无贡献等级
zxc123zdq  LV14 3月7日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友